note 33555 added to ref.session
| From: | tomhunter at runbox dot com | Date: | Mon, 30 Jun 2003 15:30:06 +0000 |
| Subject: | note 33555 added to ref.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51218@lists.php.net to get a copy of this message | ||
DANGER, WATCH OUT!
Using the superglobal $_SESSION array with DB queries is dangerous. EG:
mysql_query("select foo from bar where
username='$_SESSION['username']'");
TOO MANY QUOTES!
Instead:
$q = "select foo from bar where
username='".$_SESSION['username']."'";
mysql_query($q);
But, then...you probably knew that already.
----
Manual Page -- http://www.php.net/manual/en/ref.session.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33555
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33555&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33555&report=yes