imarockstar Posted August 21, 2008 Share Posted August 21, 2008 I am trying to pull data from the db using this statement ... (line 44 reads ) $result = mysql_query("select * from jobs where recid = '. $_SESSION['recid']' "); this is my error : Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/franklin/public_html/sites/dwf/admin_jobs_view.php on line 44 Link to comment https://forums.phpfreaks.com/topic/120761-session-variable-help/ Share on other sites More sharing options...
lemmin Posted August 21, 2008 Share Posted August 21, 2008 It should be like this: $result = mysql_query("select * from jobs where recid = ". $_SESSION['recid']); Link to comment https://forums.phpfreaks.com/topic/120761-session-variable-help/#findComment-622412 Share on other sites More sharing options...
BlueSkyIS Posted August 21, 2008 Share Posted August 21, 2008 best to single-quote ALL values (numeric and string) in MySQL. i would do this: $result = mysql_query("select * from jobs where recid = '{$_SESSION['recid']}'") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/120761-session-variable-help/#findComment-622415 Share on other sites More sharing options...
imarockstar Posted August 21, 2008 Author Share Posted August 21, 2008 thanks that fixed it Link to comment https://forums.phpfreaks.com/topic/120761-session-variable-help/#findComment-622424 Share on other sites More sharing options...
lemmin Posted August 21, 2008 Share Posted August 21, 2008 best to single-quote ALL values (numeric and string) in MySQL. i would do this: $result = mysql_query("select * from jobs where recid = '{$_SESSION['recid']}'") or die(mysql_error()); Why would you ever want a numeric value in single quotes? Link to comment https://forums.phpfreaks.com/topic/120761-session-variable-help/#findComment-622457 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.