RE: [PHP] i'm beginner and i couldn't solve the problem
| From: | Richard Lynch | Date: | Wed, 08 Dec 2004 18:40:01 +0000 |
| Subject: | RE: [PHP] i'm beginner and i couldn't solve the problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-203751@lists.php.net to get a copy of this message | ||
Chris W. Parker wrote:
> Ford, Mike <mailto:M.Ford@leedsmet.ac.uk>
> on Wednesday, December 08, 2004 5:18 AM said:
>
>>> $sql = "INSERT INTO testTable values ('',
>>> '$_POST[testField]')";
>>>
>>> should be
>>>
>>> $var = $_POST["testField"];
>>> $sql = "INSERT INTO testTable values ('', '$var')";
>>
>> Nope -- the original is functionally identical to your suggested
>> correction.
>
> Hmm... I thought arrays don't work correctly within a string unless they
> are wrapped with { and }?
That is a misconception on your part. Read the manual. It's quite clear
and concise.
http://www.php.net/manual/en/language.types.string.php
Arrays of MORE THAN ONE DIMENSION will need { and }
One-dimension arrays work just fine without.
--
Like Music?
http://l-i-e.com/artists.htm