Reading mySQL works then won't
Posted: Sun Sep 04, 2005 4:30 am
A little help please
When I use this peice of code to query my db it works fine:
But if I change the WHERE from the LKey which is the primary to Username which is a unique field I keep getting this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /xxxxxx/local/home/xxxxxx/xxxxxxxx.com/rs/admin222.php on line 26
Can any one tell me why I can not use the Username field or any other field I would need to use.
This is driving me nuts
Thank You
Len
When I use this peice of code to query my db it works fine:
Code: Select all
$sql = "SELECT * FROM twisted WHERE LKey=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result); // NO ERROR LINE 26
$id = $myrow["LKey"];
$First = $myrow["Fname"];But if I change the WHERE from the LKey which is the primary to Username which is a unique field I keep getting this error:
Code: Select all
$sql = "SELECT * FROM twisted WHERE Username=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result); // ERROR HERE LINE 26
$id = $myrow["LKey"];
$First = $myrow["Fname"];Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /xxxxxx/local/home/xxxxxx/xxxxxxxx.com/rs/admin222.php on line 26
Can any one tell me why I can not use the Username field or any other field I would need to use.
This is driving me nuts
Thank You
Len