Can't find the error..

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
chson
New php-forum User
New php-forum User
Posts: 8
Joined: Mon Oct 14, 2002 5:57 pm

Can't find the error..

Post by 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

DoppyNL

Post by 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

chson
New php-forum User
New php-forum User
Posts: 8
Joined: Mon Oct 14, 2002 5:57 pm

Post by chson » Fri Nov 01, 2002 3:11 pm

Thanks DoppyNL. Removed the 1st "rank" in the query and it worked fine.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests