Re: Re: Vars inside an sql query [Regular expression question]
| From: | Hatem Ben | Date: | Thu, 12 Jun 2003 13:47:06 +0000 |
| Subject: | Re: Re: Vars inside an sql query [Regular expression question] | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151254@lists.php.net to get a copy of this message | ||
I agree with you Jay, but those cases are already done, and i got no problem
with RE there
Thanks anyway
Hatem
----- Original Message -----
From: "Jay Blanchard" <jay.blanchard@niicommunications.com>
To: "Monu Ogbe" <monu@houxou.com>; <php-general@lists.php.net>
Sent: Thursday, June 12, 2003 3:17 PM
Subject: RE: [PHP] Re: Vars inside an sql query [Regular expression
question]
[snip]
$string = "select * FROM
table where id='$value' order by name";
[/snip]
I know it ain't pretty, but the coding style we have accepted is
this....
$string = "select * FROM table where id = '" . $value . "'
order by
name ";
or (we requite caps on reserved words)...
$string = "SELECT * ";
$string .= "FROM table ";
$string .= "WHERE id = '" . $value . "' ";
$string .= "ORDER BY name ";
No ambiguity and cleaner on longer queries.
It's all in preference I suppose.
Jay
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php