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.

Try

"WHERE ho_uniqueid='".$_SESSION['uid']."'";

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

Ahh, add a space before your WHERE, right now you have SELECT * FROM myTableWHERE...

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.