|
Posted by john on 05/04/07 00:02
All:
I'm a long-time developer, new to PHP....
Is there an idiom used in PHP to construct SQL statments from $_POST
data?
I would guess that in many applications, the data read from $_POST are
used to build SQL statements. Certainly, we can do the following:
$email = $_POST['email']
$sql = "insert ... values ('$email')..."
However, pulling out each variable from the $_POST array seems
awkward.
The problem with constructing a string comes in due to the fact that
you often need to quote strings in the SQL statement, e.g, $sql =
"insert...values('$_POST['email']..)" There doesn't seems to be a
combination of single and double quotes that work.
Is there a standard way people tend to build SQL strings from $_POST
(or $_GET) data in PHP?
Thanks,
John
jpuopolo
[Back to original message]
|