[PHP] newbY prob
Problem with Count. ! am trying to count the number of items in this table. The table has one field in it. The code I am using is: $dbquerymeal = select COUNT(*) from mealtype; $resultmeal = mysql_db_query($dbname,$dbqueryshipping1); if(mysql_error()!=){echo mysql_error();} $mealcount = mysql_fetch_row($resultmeal); echo $mealcount; The result I am getting is: Query was empty Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in search.php Any suggestions? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003
RE: [PHP] newbY prob
! am trying to count the number of items in this table. The table has one field in it. The code I am using is: $dbquerymeal = select COUNT(*) from mealtype; $resultmeal = mysql_db_query($dbname,$dbqueryshipping1); if(mysql_error()!=){echo mysql_error();} $mealcount = mysql_fetch_row($resultmeal); echo $mealcount; The result I am getting is: Query was empty Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in search.php Any suggestions? Where is $dbqueryshipping1 set? I see $bdquerymeal, but not $dbqueryshipping1. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbY prob
On 23 Jul 2003 at 15:38, Phillip Blancher wrote: Problem with Count. ! am trying to count the number of items in this table. The table has ! one field in it. The code I am using is: $dbquerymeal = select COUNT(*) from mealtype; $resultmeal = mysql_db_query($dbname,$dbqueryshipping1); shouldn't the second argument be $dbquerymeal ? R'twick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbY prob
From: Jennifer Goodie [EMAIL PROTECTED] ! am trying to count the number of items in this table. The table has one field in it. The code I am using is: $dbquerymeal = select COUNT(*) from mealtype; $resultmeal = mysql_db_query($dbname,$dbqueryshipping1); if(mysql_error()!=){echo mysql_error();} $mealcount = mysql_fetch_row($resultmeal); echo $mealcount; The result I am getting is: Query was empty Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in search.php Any suggestions? Where is $dbqueryshipping1 set? I see $bdquerymeal, but not $dbqueryshipping1. Also, once you fix that, $mealcount is going to be an array. You need to display $mealcount[0] to get the value. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbY prob
$dbquerymeal = select COUNT(*) from mealtype; $resultmeal = mysql_db_query($dbname,$dbqueryshipping1); if(mysql_error()!=){echo mysql_error();} $mealcount = mysql_fetch_row($resultmeal); echo $mealcount; YOUR query is not stored in ,$dbqueryshipping1 but in $dbquerymeal I believe... switch the vars and you should solve the problem.. at least that's a perfunctory glance.. You are actually better off not using that function, anyway You are probably better off doing something like: $mealcountrst = mysql_query($query); if ($mealcountrst != FALSE) { $mealcount = mysql_fetch_row($resultmeal); } else { print yo, you messed up! . mysql_error(); } // there are nicer ways to do this of course.. one is: $mealcountrst = mysql_query($query); $mealcountrst ? $mealcount = mysql_fetch_row($resultmeal) : print mysql_error(); // ps... none of this code has been tested use at your own risk. Carl Furst Chief Technical Officer Vote.com 50 Water St. South Norwalk, CT. 06854 203-854-9912 x.231 -Original Message- From: Phillip Blancher [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:38 PM To: PHP List Subject: [PHP] newbY prob Problem with Count. ! am trying to count the number of items in this table. The table has one field in it. The code I am using is: $dbquerymeal = select COUNT(*) from mealtype; $resultmeal = mysql_db_query($dbname,$dbqueryshipping1); if(mysql_error()!=){echo mysql_error();} $mealcount = mysql_fetch_row($resultmeal); echo $mealcount; The result I am getting is: Query was empty Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in search.php Any suggestions? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php