Re: mysql_result(): supplied argument is not a valid.....
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: mysql_result(): supplied argument is not a valid.....

From: Tony <tony23.no@dslextreme.com.spam>
Date: Wed Jul 13 2005 - 02:03:24 CEST

bettina@coaster.ch wrote:
> here is my code:
> line 39 $total_1 = mysql_query("SELECT COUNT(*) FROM COASTERS");
> line 40 $total_coasters = mysql_result($total_1,0,0);
> line 41 $total_2 = mysql_query("SELECT COUNT(*) FROM COUNTRIES");
> line 42 $total_countries = mysql_result($total_2,0,0);
> line 43 $GET_DATE = mysql_query("SELECT DATE_FORMAT(DATE,'%d.%m.%Y')
> FROM COASTERS ORDER BY DATE DESC LIMIT 1");
> line 44 $update = mysql_result($GET_DATE,0,0);
>
> I get errors on line 40, 42 and 44 and I'm only counting the records
> and getting the latest date,,, And what's strange is that it works
> local!!!!

As others have pointed out, you should be having some error checking:

if (!$total_1) { print mysql_error(); }

after line 39 (and one for $total_2 after line 41)- that would tell you why
you're not getting a proper result back. Otherwise, it doesn't seem to be a
code problem. Add the error checking & come back with the exact error
message you get.

-- 
Tony Garcia
Web Right! Development
Riverside, CA
www.WebRightDevelopment.com
Received on Mon Oct 17 21:06:08 2005