I'm starting using PDO
and MySQL
instead of mysqli
.
So, i try to define this simple function:
public function getIntro($table) {
$stmt = $this->db->prepare("SELECT * FROM $table ORDER BY rand() LIMIT ?");
$stmt->execute(array(6));
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
But, in doing so, the function return an empty array. Considering that the connection with the db work correctly, where is the error?
Thanks