|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-10-21 15:27 UTC] uw@php.net
[2009-10-21 15:38 UTC] chris at network-13 dot com
[2009-10-21 15:45 UTC] johannes@php.net
[2009-10-21 15:53 UTC] uw@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 05:00:02 2025 UTC |
Description: ------------ I tested this on both linux/windows with PHP 5.2.10 and it gave no problems. After updating the windows machine to PHP 5.3.0 it now gives the error. Warning: Parameter 3 to mysqli_stmt_bind_param() expected to be a reference, value given Reproduce code: --------------- <?php class db { public $result; function getresult(){ $connection = mysqli_connect('localhost', 'root', 'password', 'testdb'); $args = func_get_args(); $query = array_shift($args); if(!$connection){ mysqli_connect_error(); exit(); } $sql = mysqli_prepare($connection, $query); $types = str_repeat('s', count($args)); array_unshift($args, $types); array_unshift($args, $sql); call_user_func_array('mysqli_stmt_bind_param', $args); mysqli_stmt_execute($sql); mysqli_stmt_bind_result($sql, $result); mysqli_stmt_fetch($sql); mysqli_close($connection); $this->result = $result; } } $uid = NEW db(); $uid->getresult("SELECT uid FROM testtable WHERE user = ?","Chris"); echo $uid->result; ?> Expected result: ---------------- It should echo the uid of the user. Actual result: -------------- Warning: Parameter 3 to mysqli_stmt_bind_param() expected to be a reference, value given in D:\www\mysqli2.php on line 16