lukep11a Posted June 27, 2011 Share Posted June 27, 2011 Hi, I am trying to write a query which will bring back entries associated to the user that has logged in, below is the code that I have to call the row with the users info in but so far it's not working. <?php $query = "SELECT * FROM selections WHERE username = '$_SESSION['username']'"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { ?> Any help would be very much appreciated. Thanks Luke Link to comment https://forums.phpfreaks.com/topic/240552-help-on-query-required/ Share on other sites More sharing options...
fugix Posted June 27, 2011 Share Posted June 27, 2011 use the complex syntax on your session inside of you query, also, add some debugging just in case that fails <?php $query = "SELECT * FROM selections WHERE username = '{$_SESSION['username']}'"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { ?> Link to comment https://forums.phpfreaks.com/topic/240552-help-on-query-required/#findComment-1235601 Share on other sites More sharing options...
lukep11a Posted June 27, 2011 Author Share Posted June 27, 2011 Thankyou for your quick response, I have made those changes but am now getting a syntax error: Parse error: syntax error, unexpected $end in /home/content/65/7684865/html/member-home.php on line 124 line 124 is the very last line of code, any ideas why it may be doing this? Link to comment https://forums.phpfreaks.com/topic/240552-help-on-query-required/#findComment-1235613 Share on other sites More sharing options...
fugix Posted June 27, 2011 Share Posted June 27, 2011 the error isn't caused by the code that I provided, most likely your are missing a closing curly bracket somewhere. If you cant figure it out post your code and I will look at it Link to comment https://forums.phpfreaks.com/topic/240552-help-on-query-required/#findComment-1235625 Share on other sites More sharing options...
lukep11a Posted June 27, 2011 Author Share Posted June 27, 2011 Thankyou you were right I was missing the closing bracket!! Thanks for your help it works fine now Link to comment https://forums.phpfreaks.com/topic/240552-help-on-query-required/#findComment-1235627 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.