This is a discussion on RE: [PHP] newbY prob within the PHP General forums, part of the PHP Programming Forums category; > ! am trying to count the number of items in this table. The table > has one field in it. &...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
> ! 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. |
|
|||
|
From: "Jennifer Goodie" <goodie@apollointeractive.com>
> > ! 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... |