> -----Original Message-----
> From: Erik Price [mailto:[EMAIL PROTECTED]]
> Sent: 10 January 2002 15:44
>
> I thought that $_GET[] and $_POST[] could be used in place of regular
> variables... that is,
>
> $sql = "SELECT * FROM tablename WHERE
> tablename.column=$_GET['criteria_integer']";
>
> but unfortunately, this isn't working.
No, of course not -- I repeat:
> On Thursday, January 10, 2002, at 08:18 AM, Ford, Mike [LSS] wrote:
>
> > But, if you insist on the quotes, it needs to be:
> >
> > case "{$_POST['insert']}"
> >
> > to ensure that the array index gets processed properly.
Please note the {}, which you *MUST* include to get the array index processed
properly. If you write:
"$_POST['insert']"
PHP will try to interpret this as the variable called $_POST followed by the string
"['insert']", which is clearly not what you want. including the {} forces it to use
the value of $_POST['insert'], which *is* what you want.
Incidentally, I've occasionally had problems including a variable name containing an
underscore in a double-quoted string (e.g. "$num_recs records retrieved"), where PHP
tries to insert the value of $num followed by the string "_recs", so I always {} those
as well, just to be on the safe side ("{$num_recs} ..." or "${num_recs} ..." both work.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]