$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

Reply via email to