Forums

PHP

This topic is locked

session variable from recordset

Posted 16 Sep 2008 19:04:33
1
has voted
16 Sep 2008 19:04:33 Chris Trace posted:
Hey there i am trying to get a recordset to return based on the ID of another table and recordset
that is

$_SESSION[gardenpiclist] = '<?php echo $row_selectedgardenpic['siteid']; ?>';

then

$query_gardenpiclist = "SELECT * FROM siteimage WHERE siteimage.siteid = "$_SESSION[gardenpiclist]"";

and getting this error

Parse error: syntax error, unexpected T_STRING in /home/backyard/public_html/My Canvas/individualgardenimagedisplay.php on line 315

or i am better off trying to use a join query?
any help?
thanks

Replies

Replied 25 Sep 2008 09:43:56
25 Sep 2008 09:43:56 Alan C replied:
you probably worked something out for this by now, but here's my 10c worth anyway

that looks like a php error message, is it the double quotes ?

$query_gardenpiclist = "SELECT * FROM siteimage WHERE siteimage.siteid = "$_SESSION[gardenpiclist]"";

the first double quotes close, then there is no operator before the $_

maybe

$query_gardenpiclist = "SELECT * FROM siteimage WHERE siteimage.siteid = ".$_SESSION[gardenpiclist];

Reply to this topic