# HG changeset patch # User Matti Hamalainen # Date 1506510971 -10800 # Node ID 0eca3f1b1d489476bc9782973884ee8ab1afe50e # Parent ed9270f65a37bc219181f3ff09133b11652f68a2 Improve error handling. diff -r ed9270f65a37 -r 0eca3f1b1d48 admajax.php --- a/admajax.php Sun Feb 05 03:49:38 2017 +0200 +++ b/admajax.php Wed Sep 27 14:16:11 2017 +0300 @@ -1279,8 +1279,7 @@ "
Controls for competition showing mode. Select and activate desired compo, then ". "hit 'Next entry' to activate the first entry to show. Notice! You need to have generated 'show positions' ". "before starting compos!
\n". - "
\n". - stGetFormOptionListStart("ctrlCompoList", " ", TRUE); + "
\n"; $sql = "SELECT compos.*, ". @@ -1293,16 +1292,19 @@ $currCompoID = stGetDisplayVar("compoID"); if (($res = stExecSQL($sql)) !== false) { + echo stGetFormOptionListStart("ctrlCompoList", " ", TRUE); foreach ($res as $item) { echo stGetFormOptionListItem(" ", $item["id"], ($item["id"] == $currCompoID), sprintf("%-20s (%d entries)", substr($item["name"], 0, 20), $item["nentries"])); } + echo stGetFormOptionListEnd(" ", TRUE); } + else + echo "ERROR"; echo - stGetFormOptionListEnd(" ", TRUE). "
\n". " ".stGetFormButtonInput("setcompo", "", "", "Change compo", "activateCompo()")."\n". "
\n". @@ -1334,13 +1336,18 @@ "
\n"; $sql = "SELECT * FROM news ORDER BY utime DESC"; - foreach (stExecSQL($sql) as $item) + if (($res = stExecSQL($sql)) !== false) { - echo - "
\n". - stGetNewsItemData($item["id"], $item, "ne"). - "
\n"; + foreach ($res as $item) + { + echo + "
\n". + stGetNewsItemData($item["id"], $item, "ne"). + "
\n"; + } } + else + echo "ERROR"; break; case "newsitem":