-2

I have the following prepared statement for select query

$product_info = $this->mysqliengine->prepare("select product_id, sku from product limit 10");
        $product_info->execute();
        $res = $product_info->bind_result();
        while($row = $res->fetch_assoc()) {
            echo $row['sku'].'<br />';
        }

But It is showing fatal error as

Fatal error: Call to a member function fetch_assoc() on a non-object

kndwsu
  • 371
  • 1
  • 8
  • 21
  • 1
    This question has been asked many thousand times before. Some of those duplicates were shown to you while you entered your question title. – Pekka Jan 11 '14 at 07:00
  • @Pekka웃 Yes I referred previous questions but I could not find my silly mistke – kndwsu Jan 11 '14 at 07:02
  • @EditmeHere well if the only problem left is to debug your code, there is no point in asking for the gazillionth time about php, mysqli or prepared-statement, or is it? – kuroi neko Jan 11 '14 at 07:19

1 Answers1

0

try to debug yourself

I hope this will solve

$product_info = $this->mysqliengine->prepare("select product_id, sku from product limit 10");
        $product_info->execute();
        $product_info->bind_result($product_id,$sku);

        while($product_info->fetch()) {
            echo $product_id.'<br />';
        }
        $product_info->close();
Prabhakaran
  • 3,900
  • 15
  • 46
  • 113