-2

Hi this may sound noob but i have recently started working mysqli->prepare() i have a following code and i want to return back the data from my model function to controller so that i can loop through the data how can i do that?

function get_student(){
 $sql = "select student_id from student";
    $stmt = $this->db_con->prepare($sql);
    $stmt->execute();
    $stmt->bind_result($student_id);
    return ?
   }

  $result = $model->get_student();

PS : I don't want to store my result in an array and than return i know how to do that

ahmad05
  • 438
  • 2
  • 6
  • 23

1 Answers1

-1

return $stmt->get_result();

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345