Need help fetching an array using prepared statments

Posted by eldan221 on Stack Overflow See other posts from Stack Overflow or by eldan221
Published on 2014-08-21T16:17:38Z Indexed on 2014/08/21 16:19 UTC
Read the original article Hit count: 143

Filed under:
|
|

I have wrote the following code to fetch a string. But for some reason its only returning 1.

I have doubled checked everything and it seems like its correct. I am not sure why its only returning 1?

Any help here would be really appreciated!

//Class Defined here

   function MenuCat($id){


    $query = "SELECT menu_category_description FROM menu_categories WHERE id = ?";
    $stmt = $this->db->prepare($query);
    $stmt->bind_param("i", $id);
    $stmt->execute();
    $stmt->bind_result($menu_category_description);
    $row = $stmt->fetch();

return $row;

}

$display_category = $cat_des->MenuCat($id);

 echo $display_category

© Stack Overflow or respective owner

Related posts about php

Related posts about mysqli