I have a simple problem, that my MySQLi function only shows one row / result in var_dump:
$sql = $db->query('SELECT * FROM '.$db_prefix.'_posts');
$row = $sql->fetch_array();
var_dump($row);
That's it. The query in phpMyAdmin shows 3 results. This one only 1. It also doesn't work with fetch_assoc() or fetch_array().
Edit: Also, I want to have the keys of the table being listed as with "fetch_array()".
Try this:
You would have to iterate your results. You can always use something like this:
However this would output a lot of data (because of the var_dump). For a clean output you could use
fetch_row() will only contain 1 row at a time
Try a while loop:
Because
fetch_row()
,fetch_array()
,fetch_assoc()
will all return one row every singe time it's being called untill it is 'out of rows'.