mike12255 Posted January 20, 2011 Share Posted January 20, 2011 Im just trying to get this query to retrieve one peice of data about a user if they are logged in however instead of producing any sort of mysql errors or anything it just stops the page from loading properly. Can anyone help solve this? here is my query code: $query = "SELECT credits FROM users WHERE username = $session->username"; $res = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_assoc($res); $ans = $res['credits']; Link to comment https://forums.phpfreaks.com/topic/225044-query-problem/ Share on other sites More sharing options...
ohdang888 Posted January 20, 2011 Share Posted January 20, 2011 try this: $query = "SELECT credits FROM users WHERE username = '".$session->username."' "; $res = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($res); $ans = $res['credits']; Link to comment https://forums.phpfreaks.com/topic/225044-query-problem/#findComment-1162325 Share on other sites More sharing options...
mike12255 Posted January 20, 2011 Author Share Posted January 20, 2011 I swear i tried that none the less it worked thanks, for the help and letting me know its time for a break. Link to comment https://forums.phpfreaks.com/topic/225044-query-problem/#findComment-1162326 Share on other sites More sharing options...
parino_esquilado Posted January 20, 2011 Share Posted January 20, 2011 Why is your indentation so mismatched? Link to comment https://forums.phpfreaks.com/topic/225044-query-problem/#findComment-1162327 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.