From 54522e16c76c3665f3683a77f3538109a50704fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Sat, 7 Jul 2001 12:37:15 +0000 Subject: [PATCH] Fix suggested by Michael Tacelosky into the phpwizard forum --- ChangeLog | 4 +++- sql.php3 | 18 +++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index a5383e2db..1f0dc131c 100755 --- a/ChangeLog +++ b/ChangeLog @@ -8,7 +8,9 @@ $Source$ 2001-07-07 Loïc Chapeaux * left.php3: improved the css. * left.js: try to "fix" the Opera and Konqueror bug (bad DOM implemenation - -> list is no long expandable/collapsible with this browsers) + -> list is no long expandable/collapsible with this browsers). + * sql.php3, lines 85-93: fix suggested by + Michael Tacelosky into the phpwizard forum. 2001-07-06 Loïc Chapeaux * users_details.php3: fixed many little scripting bugs. diff --git a/sql.php3 b/sql.php3 index b9feaf417..3dc7b9af3 100755 --- a/sql.php3 +++ b/sql.php3 @@ -79,14 +79,18 @@ else { $result = mysql_query($sql_query.$sql_order.$sql_limit); // the same SELECT without LIMIT - if(eregi("^SELECT", $sql_query)) + if (eregi("^SELECT", $sql_query)) { - $array=split(' from | FROM ',$sql_query,2); //read only the from-part of the query - $count_query="select count(*) as count from $array[1]"; //and make a count(*) to count the entries - $OPresult = mysql_query($count_query); - if ($OPresult) { - $SelectNumRows = mysql_result($OPresult,'0','count'); - } + $array = split(' from | FROM ',$sql_query,2); //read only the from-part of the query + if (!empty(trim($array[1]))) { + $count_query = "select count(*) as count from $array[1]"; //and make a count(*) to count the entries + $OPresult = mysql_query($count_query); + if ($OPresult) { + $SelectNumRows = mysql_result($OPresult,'0','count'); + } + } else { + $SelectNumRows = 0; + } } if(!$result)