note 114327 deleted from sqlite3stmt.bindparam by cmb
| From: | cmb@php.net | Date: | Sun, 11 Nov 2018 14:06:58 +0000 |
| Subject: | note 114327 deleted from sqlite3stmt.bindparam by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209664@lists.php.net to get a copy of this message | ||
Note Submitter: Cassiano Martin
----
If you use any function to put value into an array, and bind it to the statement, PHP will fill
NULLs on the binded field.
eg:
$st=$db->prepare('insert into xxx(x1,x2,x3) values(?,?,?)');
$st->bindParam(1, $data[0], SQLITE3_TEXT);
$st->bindParam(2, $data[1], SQLITE3_TEXT);
$st->bindParam(3, $data[2], SQLITE3_TEXT);
$data=explode(',','php,sometimes,woofs');
This will completely fail, and NULLs will be inserted on the table.
You need to manually assign every variable on the array. Any other function which completes it, will
fail and NULLs are inserted.
$temp=explode(',','php,sometimes,woofs');
$data[0]=$temp[0];
$data[1]=$temp[1];
$data[2]=$temp[2];