Hi Everyone. I am having a bit of a mysterious error that I cannot find a
solution to.
I can manually assign a value to $uid and everything works. With a var though,
I keep
getting an error about mysql _query not having a valid resource.
I cannot get variables to work in my sql statements; I have tried quotes,
brackets, braces,
etc. Any idears would be greatly appreaciated.
<?PHP
//var passed from calling function;
$uid;
//test to see if value is indeed making it over from calling function
echo $uid;
//mysql query
$sql = "SELECT u_name FROM members WHERE u_name = {$uid}";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result) {
//test to try and figure out what is going on
echo $row['u_name'];
//tenery statement to evaluate and reassign value to $uid.
//this statement should live inside the while loop!
$uid = (!$result || $result == NULL || $result == '0') ? NULL : $row['u_name'];
}
?>