php - bind_param giving error "Parameter 3 to mysqli_stmt_bind_param() expected to be a reference" -


i'm trying values of column datetime , using values number of entries made on day. i'm passing array bind_param. here error:

"parameter 3 mysqli_stmt_bind_param() expected reference"

i've tried commented method doesn't seem work either. here's code :

<?php $hostname = "localhost"; $database = "ti_project"; $username = "root"; $password = ""; $mysqli = new mysqli($hostname, $username, $password, $database);  $query = "select datetime feedback"; $result = $mysqli->prepare($query); /*$result->bind_param('s', $datetime);*/ $result->execute();  $result->bind_result($date);  while ($result->fetch()){  $feedbackdate[] = array($date); }  $type="s"; $query = "select count(*) feedback datetime = ?"; $result = $mysqli->prepare($query); call_user_func_array('mysqli_stmt_bind_param',                  array_merge (array($result, $type),$feedbackdate));  $result->execute();   /*$ref    = new reflectionclass('mysqli_stmt');  $method = $ref->getmethod("bind_param");  $method->invokeargs($result,$feedbackdate);  $result->execute();  *$result->bind_*result($count);*/  while ($result->fetch()){     $count[] = array(     'count' => $count ); } echo json_encode($count);  $result->close();  $mysqli->close();  ?> 

missing statement variable in function call. function accepts 3 parameters , not 2. missing provide prepared statement.

call_user_func_array('mysqli_stmt_bind_param', $stmt, array_merge (array($result, $type), $feedbackdate)); 

please read mysqli_stmt_bind_param function reference here


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -