Re: [PHP-DB] Re: [PHP] $_POST in MySQL query issue...

2003-10-17 Thread Jon Kriek
Since this was posted in php.general and php.db, I only ended up correcting myself to the orginal poster and to php.general. $table= 'elements'; $Name = mysql_escape_string($_POST['elementName']); $sql = "INSERT INTO $table SET Name= '$Name'"; >> waste of variable space, and makes what you are do

Re: [PHP-DB] Re: [PHP] $_POST in MySQL query issue...

2003-10-16 Thread Peter Beckman
On Thu, 16 Oct 2003, Jon Kriek wrote: > I concur, assign the superglobal array to a variable ... > > $Name = strip_slashes($_POST['elementName']); > $sql="INSERT INTO $table SET Name='$Name'"]; > > ... and then use that opportunity to run additional checks on the content. Again, waste of variabl

Re: [PHP-DB] Re: [PHP] $_POST in MySQL query issue...

2003-10-16 Thread Peter Beckman
On Fri, 17 Oct 2003, BAO RuiXian wrote: > I see you can achieve this by two ways: > > 1. Take out all the inside quotes (single or double) like the following: > > $sql="insert into $table set Name = $_POST[elementName]"; This is bad. Using no quotes MAY work, but it is considered a

[PHP-DB] Re: [PHP] $_POST in MySQL query issue...

2003-10-16 Thread Jon Kriek
Actually, I meant to suggest addslashes() and mysql_espace_string() -- Jon Kriek http://phpfreaks.com "Jon Kriek" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I concur, assign the superglobal array to a variable ... > > > > $Name = strip_slashes($_POST['elementName']); > $sql="I

[PHP-DB] Re: [PHP] $_POST in MySQL query issue...

2003-10-16 Thread Jon Kriek
I concur, assign the superglobal array to a variable ... $Name = strip_slashes($_POST['elementName']); $sql="INSERT INTO $table SET Name='$Name'"]; ... and then use that opportunity to run additional checks on the content. -- Jon Kriek http://phpfreaks.com -- PHP Database Mailing List (http

[PHP-DB] Re: [PHP] $_POST in MySQL query issue...

2003-10-16 Thread BAO RuiXian
Adam Reiswig wrote: $table="elements"; $sql="insert into $table set Name = '$elementName'"; This works with register_globals set to on. But, I want to be able to turn that off. My code then, I am guessing, be something as follows: $table="elements"; $sql="insert into $table set Name = '$_POS