I agree with Chris, the quote should stay there to prevent confusion.
 Nevertheless, I often run in the same problem. Sometimes, the only way to
fix it is by removing the quotes ($_GET[id]).

I know PHP documents goes against this, but it dosn't always work with the
quotes.

Perhaps the dev team can look more into this.

-john

=P e p i e  D e s i g n s
 www.pepiedesigns.com
 Providing Solutions That Increase Productivity

 Web Developement. Database. Hosting. Multimedia.

On Wed, 15 Jan 2003, Chris Hayes wrote:

> At 11:57 15-1-03, Marek Kilimajer wrote:
> >"SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET[id]";
> >
> >- removed single quotes
>
> I think that that is a really bad advice.
>
> Let me explain.
>
> For one, the single quotes are not in the way here because the query is
> written between double quotes.
>
> Then, leaving out the single quotes like Marek suggests will only work
> because PHP is too programmer-friendly.
> But the indexes of such arrays should always be quoted, because they are
> strings, and not the name of 'constant' values. If you do not quote them
> PHP will first try to look up whether you defined id somewhere, as a
> constant (with define ('id','value');). Which you did not, so PHP will fail
> to find it. Only then PHP will gently assume that since there is no
> constant defined with the name id, that you meant 'id'. Valuable processing
> time wasted for no reason.
> Set error_reporting to ~E_ALL if you do not believe me.
>
> I would support  the $_POST suggestion by Jason.
>
> Suggested reading: the 'PHP Bible'.
>
>
>
> --
> 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