0

So near and yet so far.

I introduced myself to session control and made a decision to only use session files (not cookies)

I am submitting:
session_start( );
$_SESSION = $iduse;

The session file is created and correctly reads the following where the value of $iduse is 1H:
barney|s:2:"1H";

In my second form, I am trying to construct a MYSQL query using the variable in the session file:
$query = "SELECT * FROM mytable";
$query.= "WHERE ho_uniqueid=".$_SESSION."";

I am starting the page with session_start(); Unfortunately I am getting an SQL syntax error .......syntax to use near '=1H' at line 1

My register globals in my php.ini read; register_globals = off (however the same error occurs if register_globals = on)

I have read lots and visited many sites but to no avail.

Does anyone have any suggestions?
Many thanks.

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by Thorby68
0

Thanks, but I am now getting syntax to use near '='1H'' at line 1 instead of '=1H'

0

this error has to do with your sql syntax try and check if you are not missing any of the quotes( " and ')

0

Kaion, you are a star, the space before Where did the trick and has put an end to my 3 hours of fruitless searching.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.