session variable in sql query

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

pugs421
New php-forum User
New php-forum User
Posts: 31
Joined: Sat Jun 28, 2003 9:09 pm

session variable in sql query

Postby pugs421 » Sat Jul 05, 2003 7:37 am

I cant figure out the right way to put the session varible into the query. (quotes, parenthesis, etc)



"INSERT INTO setup (photo) VALUES ('$f_org') WHERE screen_name = $_SESSION['screen_name']",

liquedus
php-forum Active User
php-forum Active User
Posts: 266
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada
Contact:

Postby liquedus » Sat Jul 05, 2003 5:40 pm

"INSERT INTO setup (photo) VALUES ('$f_org') WHERE screen_name = '".$_SESSION['screen_name']."'"

:P

User avatar
bezmond
Moderator
Moderator
Posts: 312
Joined: Sat Apr 05, 2003 4:33 am
Location: Mansfield, UK
Contact:

Postby bezmond » Sun Jul 06, 2003 1:38 am

$screen_name = $_SESSION['screen_name'];
"INSERT INTO setup (photo) VALUES ('$f_org') WHERE screen_name = $screen_name";

would also work :)

Andrew


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest