Do you have a question? Post it now! No Registration Necessary. Now with pictures!
February 13, 2006, 3:42 pm
rate this thread
I'm using a session variable to store a userID after login and trying
to build a query using this variable. I have session_start() at the top
of each page and have registered the variable like so ($username is an
e-mail address taken from some user input)...
By echoing it on each page I can see that the $user session variable is
correctly passed through several pages (where it doesn't get used), but
when I come to actually use it to build a query using the following
line of code...
$getmovlist="SELECT movTitle, movYear FROM movie WHERE movID=(SELECT
movID FROM fMovie WHERE uID='" .$user ."')";
... the query which is constructed is...
SELECT movTitle, movYear FROM movie WHERE movID=(SELECT movID FROM
fMovie WHERE uID='cxi03u')
which returns nothing as the end of the email address (@cs.nott.ac.uk)
has been cut off. If I echo the variable before inserting it into the
query it outputs the variable correctly (firstname.lastname@example.org)
alongside the incorrect query, but then if I refresh the page the value
of the variable has changed to cxi03u.