Re: $_POST in MySQL query issue...

From: Date: Fri, 17 Oct 2003 01:11:06 +0000
Subject: Re: $_POST in MySQL query issue...
References: 1  Groups: php.db php.general php.windows 
Request: Send a blank email to php-db+get-31087@lists.php.net to get a copy of this message
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 = '$_POST["elementName"]'";
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]"; 2. Use a temporary variable for $_POST[elementName], like $elementName = $_POST[elementName], then continute use your original SQL sentence when the register_globals was on. Best Bao
Unfortunately this and every other combination I can think of, combinations of quotes that is, does not work. I believe the source of the problem is the quotes within quotes within quotes. I also tried:


« previous php.db (#31087) next »