note 33555 deleted from ref.session by didou
| From: | didou@php.net | Date: | Mon, 07 Jul 2003 14:59:39 +0000 |
| Subject: | note 33555 deleted from ref.session by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-51633@lists.php.net to get a copy of this message | ||
Note Submitter: tomhunter@runbox.com
----
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.