|
Posted by Rowan on 01/07/08 22:31
On Jan 6, 8:15 pm, Rowan <yaard...@gmail.com> wrote:
> I'm trying to enter data from an array ( eg entry1=(x=>y,a=b),
> entry2=(x=>y,a=>c)) I'm trying to use place holders to dump the data.
> It maybe late but I can't get this to work. below is the actual
> routine used to exec. any idea on how to better format this.
>
figured out the problem. For reference see below I got this from the
php.net page.
If you're using bindParam in a loop such as this:
$counter=1;
foreach($email as $val){
$stmt->bindParam($counter, $val, PDO::PARAM_STR);
$counter++;
}
It will fail because $val is local and the variable is bound as a
reference and will only be evaluated at the time that PDOStatement-
>execute() is called.
So use bindValue instead.
Navigation:
[Reply to this message]
|