snowman15 Posted March 9, 2008 Share Posted March 9, 2008 Hey everyone, for some reason, this script isnt working. It just doesn't echo anything. What is wrong with my syntax? $query="SELECT * FROM `users` WHERE `user` LIKE $username;"; $result = $db->query($query); $row= $result->fetch_assoc(); $fname=$row['first']; $lname=$row['last']; echo "$fname $lname"; assuming $username is set Quote Link to comment Share on other sites More sharing options...
fenway Posted March 10, 2008 Share Posted March 10, 2008 Other than the trailing semicolon in the query that shouldn't be there, this is clearly a DB class. How do you know you're getting any rows back? Quote Link to comment Share on other sites More sharing options...
Barand Posted March 12, 2008 Share Posted March 12, 2008 String variables need quotes otherwise SQL thinks they are column names. Check the value of mysql_error() $query="SELECT * FROM `users` WHERE `user` LIKE '$username' "; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.