RE: [PHP] Parse Error(Newbie)
| From: | David Freeman | Date: | Mon, 27 May 2002 06:02:25 +0000 |
| Subject: | RE: [PHP] Parse Error(Newbie) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-99335@lists.php.net to get a copy of this message | ||
-----Original Message-----
I know it is probably something obvious but the following gives me a
parse error and as a newbie I am having trouble locating it.
$query = "select * from news WHERE id = "$_get['id']"";
-----Original Message-----
Any time you end up with two " characters together is a pretty good
indication of where you problem is.
You might try this:
$query = "SELECT * FROM news WHERE ID = '" . $_get['id'] .
"'";
Alternately, and depending on what you're doing and why, it might be
more effective to do this:
$idstring = $_get['id'];
$query = "SELECT * FROM news WHERE ID = '$idstring'";
Your choice...
CYA, Dave