Doc #62598 [NEW]: Mistake in user comment
| From: | the dot music dot of dot the dot ainur at gmail dot com | Date: | Wed, 18 Jul 2012 12:23:55 +0000 |
| Subject: | Doc #62598 [NEW]: Mistake in user comment | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-8569@lists.php.net to get a copy of this message | ||
From: the dot music dot of dot the dot ainur at gmail dot com
Operating system: N/A
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Mistake in user comment
Description:
------------
On this documument page :
http://php.net/manual/fr/mysqli-stmt.bind-param.php
Last user comment (nick9v at hotmail dot com 30-Jun-2012 10:12) is very
useful but contains a little mistake.
The function
public function add( $type, $value ){
$this->values[] = $value;
$this->types .= $type;
}
Should be
public function add( $type, &$value ){
$this->values[] = $value;
$this->types .= $type;
}
Otherwise, this :
call_user_func_array( array($stm, 'bind_param'), $bindParam->get());
Will return this :
Warning: Parameter 2 to mysqli_stmt::bind_param() expected to be a
reference, value given
Test script:
---------------
// class BindParam copied from user comment
$bindParam = new BindParam();
$qArray = array();
$column1NewValue = $_POST['column1'];
$column2NewValue = $_POST['column1'];
$qArray[] = 'Column1 = ?';
$bindParam->add('i', $column1NewValue );
$qArray[] = 'Column2 = ?';
$bindParam->add('s', $column2NewValue );
$query = 'UPDATE myTable SET ';
$query.= implode(' , ', $qArray);
$query.= ' WHERE PKeyID= ?';
$bindParam->add('i', $lineToUpdate);
$stmt = $mysqli->prepare($query);
call_user_func_array(array($stmt, 'bind_param'), $bindParam->get());
$stmt->execute();
$stmt->close();
Expected result:
----------------
Row in database properly updated.
Actual result:
--------------
( ! ) Warning: Parameter 2 to mysqli_stmt::bind_param() expected to be a
reference, value given in c:\path\myfile.php on line 157
Call Stack
# Time Memory Function Location
1 0.0010 297832 {main}( ) ..\myfile.php:0
2 0.0059 322952 call_user_func_array ( ) ..\myfile.php:157
--
Edit bug report at https://bugs.php.net/bug.php?id=62598&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62598&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62598&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62598&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62598&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62598&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62598&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62598&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62598&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62598&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62598&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62598&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62598&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62598&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62598&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62598&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62598&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62598&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62598&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62598&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62598&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62598&r=mysqlcfg