Page 1 of 1

Errors with MySQL...

Posted: Mon Jan 26, 2004 12:04 pm
by bluh321
I get this error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/***/public_html/***/profiles.php on line 60

on this code:

Code: Select all

<?php
$sql="SELECT * FROM user WHERE login ILIKE 'bill'";
$rs=mysql_query($sql);
while($row=mysql_fetch_array($rs)){ //print out every user found}
?>
line 60 is the line starting with "while"

if I replace the $sql with:

Code: Select all

<?php
$sql="SELECT * FROM user "
?>
it works OK and every single user is printed out. and there IS a user named 'bill' Help please!

Posted: Mon Jan 26, 2004 12:26 pm
by markl999
$sql="SELECT * FROM user WHERE login ILIKE 'bill'";

ILIKE should be LIKE, though in that particular case an = would do.
Or $sql="SELECT * FROM user WHERE login LIKE '%bill%'";
$rs=mysql_query($sql) or die(mysql_error());

Posted: Tue Jan 27, 2004 3:27 am
by twigletmac
Moved to databases.

Mac