Page 1 of 1

select statement?

Posted: Wed Apr 21, 2004 10:31 pm
by tim
How do you select data fom a mysql table where username=$_SESSION['username']?

I know
$user = $_SESSION['username'];
select $ from table where username='$user'"; works

but I tried multiple formats and I get a parse error everytime

where username={$_SESSION['username']}
many more, is this possible?

Posted: Wed Apr 21, 2004 10:48 pm
by lostboy

Code: Select all

$sql ="select * from tableName where username = '".$_SESSION['usesrname']."'":
Outside the quoted string with the single quotes inside

Posted: Wed Apr 21, 2004 11:10 pm
by tim
yeah I got it :roll:

I had an syntax error before the sql statement that was messing me up. Turns out there are a few methods to do that :P

thank you