Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Can't find the error..

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Can't find the error..

Postby chson » Thu Oct 31, 2002 9:05 pm

Can anyone see the error on line 3 of this piece of code?

$rankquery = "select rank, max(rank) from info";
$rankresult = mysql_query($rankquery);
$rank = mysql_fetch_row($rankresult);

Here's the error message:

Warning: Supplied argument is not a valid MySQL result resource in /home/www/et/register.php on line 66
chson
New php-forum User
New php-forum User
 
Posts: 8
Joined: Mon Oct 14, 2002 5:57 pm

Postby DoppyNL » Fri Nov 01, 2002 12:23 am

you're selecting the field "rank" and "max(rank)" at the same time.
the max function has to be called alone (no other fields) or with group by.

Could also be possible that you're table doesn't exist or the field rank doesn't exist (typo?)

Greetz daan
DoppyNL
 

Postby chson » Fri Nov 01, 2002 3:11 pm

Thanks DoppyNL. Removed the 1st "rank" in the query and it worked fine.
chson
New php-forum User
New php-forum User
 
Posts: 8
Joined: Mon Oct 14, 2002 5:57 pm


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.