Errors with MySQL...

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
bluh321
Forum Newbie
Posts: 1
Joined: Mon Jan 26, 2004 12:04 pm

Errors with MySQL...

Post 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!
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post 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());
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Moved to databases.

Mac
Post Reply