Reply to $_POST and Building SQL Strings

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация