RE: [PHP] $_POST arrays not evaluated in sql statement -- why?
| From: | John W. Holmes | Date: | Wed, 26 Feb 2003 01:12:31 +0000 |
| Subject: | RE: [PHP] $_POST arrays not evaluated in sql statement -- why? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137168@lists.php.net to get a copy of this message | ||
>
('1','1','$date','$_POST['jersey_id'][$x]','$_POST['first'][$x]','$_POST
['
Let's just be smart and think about this for a second. Look at all of
the single quotes you've got. How do you expect PHP to be able to tell
what's a variable and what's text? Do you mean $_POST or
$_POST['jersey_id'] or $_POST['jersey_id'][$x] as the variable? PHP
can't read your mind.
Anyway, if you're going to use this method, put braces around your
variable, so PHP knows what you are sending it.
('1','1','$date','{$_POST['jersey_id'][$x]}','{$_POST['first'][$x]}'
or this method
('1','1','$date','$_POST[jersey_id][$x]','$_POST[first][$x]'
PHP will be greedy, I think, and assume you mean $_POST[jersey_id][$x]
as the variable.
Or this method
('1','1','$date','".$_POST['jersey_id'][$x]."','".$_POST['first'][$x]."'
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/