note 114327 added to sqlite3stmt.bindparam
| From: | CassianoMartin | Date: | Fri, 07 Feb 2014 17:27:44 +0000 |
| Subject: | note 114327 added to sqlite3stmt.bindparam | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198434@lists.php.net to get a copy of this message | ||
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];
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/sqlite3stmt.bindparam.php
Edit -- https://master.php.net/note/edit/114327
Del: integrated -- https://master.php.net/note/delete/114327/integrated
Del: useless -- https://master.php.net/note/delete/114327/useless
Del: bad code -- https://master.php.net/note/delete/114327/bad+code
Del: spam -- https://master.php.net/note/delete/114327/spam
Del: non-english -- https://master.php.net/note/delete/114327/non-english
Del: in docs -- https://master.php.net/note/delete/114327/in+docs
Del: other reasons-- https://master.php.net/note/delete/114327
Reject -- https://master.php.net/note/reject/114327
Search -- https://master.php.net/manage/user-notes.php