Jump to content

Help on query required


lukep11a

Recommended Posts

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

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))
	{
?>

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.