In the below code when I var_dump($result) I can see the data I want is in there... but I have yet to be able to get to it.
Code:
try {   
    $query = new dbquery(Connection::make($dbconfig['dbinfo']));
    $count = $query->runSQL("select count(*) from table_name");
    $result = $count->fetchAll();
    var_dump($result);
    echo $result[0];
    echo $result[1];
}
catch (Exception $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
}
SQL:
public function runSQL($sql, $params = NULL) {
    //Prepares the SQL Statement you pass through
    $statement = $this->pdo->prepare($sql);
    //Binds the Parameters I pass through on execute, so no need for seperate $statement->bindParam()
    $statement->execute($params);
    //Returns the statement.
    return $statement; 
}
output of var_dump:
array(1) { [0]=> array(2) { ["count(*)"]=> string(1) "3" [0]=> string(1) "3" } } Array
it's the ["count(*)] key I need, the value 3
I've tried the below and none gives me the right value:
echo $result[0];
echo $result[1];
echo $result['count(*)'];
Can anyone please advise where I am going wrong, all i want to know is the number of rows.
 
     
     
     
     
    