Forum Moderators: coopster
$results = mysql_query("SELECT * FROM users where username = $_SESSION[username]",$link) or die ("query 1: " . mysql_error());
$myrow = mysql_fetch_array($results) or die ("query 2: " . mysql_error());
I think it is pretty easy to see what I am trying to do but all I am getting is this
"query 1: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1"
please help
cheers
Try dumping the sql statement and running it on a command line to see if you get any data or at least to see what value is in the $_SESSION variable you are using.
$results = mysql_query("SELECT * FROM users where username = '" . $_SESSION['username'] . "'") or die ("query 1: " . mysql_error());
if(mysql_num_rows($result) $myrow = mysql_fetch_array($results);
or just
if($myrow = mysql_fetch_array($results))
Best regards!