Also note that variables are case sensitive in PHP. So $_get and $_GET
are not the same. If you're using the new "super-global" variables on
PHP, then you need to use $_GET['id']...

---John Holmes...

> -----Original Message-----
> From: Miguel Cruz [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 27, 2002 2:18 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Parse Error(Newbie)
> 
> On Mon, 27 May 2002 [EMAIL PROTECTED] wrote:
> > 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']"";
> 
> A lot of people have answered this already, but just for a little more
> clarification, consider this:
> 
> The reason the computer requires you to surround a string with quotes
is
> so that it knows where the string begins and ends.
> 
> If you put quotes in the middle of the string, it thinks those mark
the
> end; why would it think otherwise, since that's what quotes are for.
> 
> So people have provided you with various solutions for this. Each of
them
> involve in some way indicating more specifically what's going on.
Either
> you use a different kind of quotes (if you started the string with
single
> quotes, it will let you put double quotes inside it without getting
> confused, and vice versa), or you use the backslash character before
> internal quotes. Backslash is the "escape" character which in this
case
> tells the parser to ignore the special meaning of the quote that
follows.
> So your line could have been written in any of the following ways:
> 
>   $query = "select * from news WHERE id = '{$_get['id']}'";
>   $query = "select * from news WHERE id = \"{$_get['id']}\"";
>   $query = 'select * from news WHERE id = "' . $_get['id'] . '"';
> 
> miguel
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to