changeset 411:2aa58de08d6d

If show_id for entry is 0, ignore it.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 05 Dec 2013 17:36:43 +0200
parents 298822ed0420
children 3e38433fcace
files admajax.php
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Thu Dec 05 17:12:28 2013 +0200
+++ b/admajax.php	Thu Dec 05 17:36:43 2013 +0200
@@ -194,13 +194,15 @@
 
 function stGetInfoOneEntryData($show_id, $compo_id)
 {
-  $sql = stPrepareSQL("SELECT * FROM entries WHERE show_id=%d AND compo_id=%d",
-    $show_id, $compo_id);
+  if ($show_id > 0)
+  {
+    $sql = stPrepareSQL("SELECT * FROM entries WHERE show_id=%d AND compo_id=%d",
+      $show_id, $compo_id);
 
-  if (($entry = stFetchSQL($sql)) !== false)
-    return "#".$entry["show_id"]." - ".chentities($entry["name"])." by ".chentities($entry["author"]);
-  else
-    return "-";
+    if (($entry = stFetchSQL($sql)) !== false)
+      return "#".$entry["show_id"]." - ".chentities($entry["name"])." by ".chentities($entry["author"]);
+  }
+  return "-";
 }