0

I am using mySQLi prepared statments to get some data from database. Problem is that I got this error. I really don't know how to fix it. Does someone knows where's the problem?

Here is code that I am using:

$editID=$_POST['productID'];
if ($stmt = $dbConnection->prepare("SELECT * FROM `kategorija-artikal` WHERE id= ? ")) {

            if ($stmt->bind_param('i', $editID)===false){
                    die('bind_param() failed: ' . htmlspecialchars($stmt->error));
            }
if ( false===$stmt->execute()) {
  die('execute() failed: ' . htmlspecialchars($stmt->error));
}   
$stmt->store_result();

    if ($stmt->num_rows>0){
    $result = $stmt->get_result();
        while($row =  $result->fetch_array(MYSQLI_ASSOC)) {// Fatal error
        $id=$row['id'];
        $name=$row['name'];
        $price=$row['price'];

    }
}
user3429355
  • 77
  • 2
  • 2
  • 9
  • possible duplicate of [Reference - What does this error mean in PHP?](http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – CBroe Oct 14 '14 at 12:35
  • 1
    [get_result](http://php.net/mysqli-stmt.get-result) returns false on a failure to load the resultset into memory. Add an extra error check. – scragar Oct 14 '14 at 12:36
  • @scragar you have vaild point here. get_result fails to retrive data. Is there bug with mySQLi adapter? – user3429355 Oct 14 '14 at 12:43
  • @user3429355 I don't know, could you check `$stmt->error` and see what the error is? – scragar Oct 14 '14 at 14:07

0 Answers0