note 114715 added to mysqli-stmt.bind-param
| From: | tomasz at marcinkowski dot pl | Date: | Thu, 27 Mar 2014 15:46:18 +0000 |
| Subject: | note 114715 added to mysqli-stmt.bind-param | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199058@lists.php.net to get a copy of this message | ||
When trying to bind a string param you get a "Number of variables doesn't match number of
parameters in prepared statement" error, make sure you're not wrapping the question mark
with quotes.
By mistake I had a query like:
SELECT something FROM table WHERE param_name = "?"
Binding it with <?php $stmt->bind('s', $param_value); ?> had been failing on me.
All I had to do was to remove quotes around "?".
Hope this saves someone's time.
----
Server IP: 46.17.113.2
Probable Submitter: 87.99.59.164
----
Manual Page -- http://php.net/manual/en/mysqli-stmt.bind-param.php
Edit -- https://master.php.net/note/edit/114715
Del: integrated -- https://master.php.net/note/delete/114715/integrated
Del: useless -- https://master.php.net/note/delete/114715/useless
Del: bad code -- https://master.php.net/note/delete/114715/bad+code
Del: spam -- https://master.php.net/note/delete/114715/spam
Del: non-english -- https://master.php.net/note/delete/114715/non-english
Del: in docs -- https://master.php.net/note/delete/114715/in+docs
Del: other reasons-- https://master.php.net/note/delete/114715
Reject -- https://master.php.net/note/reject/114715
Search -- https://master.php.net/manage/user-notes.php