The reason curly braces are needed are because you are putting an array
element into a string. Consider..
$sBlah = 'blah';
echo $sBlahfoo$sBlahfoo;
PHP will attempt to echo the variable $sBlahfoo twice. if you use
echo {$sBlah}foo{$sBlah}foo;
you have told php explicitly when to look for
A couple of days ago I placed a post regarding using the $_POST[]
variable in an insert sql query. Both
$sql=insert into $table set Name = '.$_POST['elementName'].';
and
$sql=insert into $table set Name = '{$_POST['elementName']}';
worked perfectly. Thanks to everyone for your help. My
A couple of days ago I placed a post regarding using the $_POST[]
variable in an insert sql query. Both
$sql=insert into $table set Name = '.$_POST['elementName'].';
and
$sql=insert into $table set Name = '{$_POST['elementName']}';
worked perfectly. Thanks to everyone for your help. My
Adam Reiswig wrote:
My question now is
regarding the curly brackets in the 2nd example. Can anyone describe
why using the curly brackets works and/or how php processes them. I
have read quite a bit about php and never come accross thier use in this
way. Thanks again.
Adam == Adam Reiswig [EMAIL PROTECTED] writes:
Adam A couple of days ago I placed a post regarding using the
Adam $_POST[] variable in an insert sql query. Both
Adam $sql=insert into $table set Name =
Adam '.$_POST['elementName'].'; and $sql=insert into $table
Adam set Name
Greetings to all. I am trying for the life of me to place a $_POST[]
variable in my MySQL query. I am running the latest stable versions of
PHP, MySQL and Apache 2 on my Win2kPro machine. My register_globals are
set to off in my php.ini. My code I am attempting create is basically
as
On Thu, 16 Oct 2003, Adam Reiswig wrote:
$sql=insert into $table set Name = '$_POST[elementName]';
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