So I'm trying to call an array which is generated from a database, here is the function in the class file:
public function select($array)
{
try
{
$result ="SELECT id,make,model FROM cars";
$stmt = $this->db->query($result);
$array = $stmt->fetchAll();
}
catch (PDOException $e)
{
echo $e->getMessage();
}
}
and here i'm trying to call the array, at least I am, quite new to this.
include ('CarsDb.class.php');
$db = new CarsDb();
$db->connect();
$carArray = $db->select($array);
var_dump($carArray);
Now the var_dump just shows NULL, however if I put a var_dump in the function it'll show the array on my page, so can anyone help me?