This is the code I have so far:-
$db = $this->getInvokeArg('bootstrap')->getPluginResource('db')->getDbAdapter();
$sql = "select * from users";
$result = $db->fetchAll($sql);
echo "<table border='1'>
<tr>
<th>ID</th>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
<th>Username</th>
<th>Password</th>
</tr>
";
while($row = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['firstname'] . "</td>";
echo "<td>" . $row['lastname'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['password'] . "</td>";
echo "</tr>";
}
echo "</table>";
I am Trying this but I recieved this error:-
Warning: mysql_fetch_array() expects parameter 1 to be resource, array given in /var/www/datashow/application/controllers/IndexController.php on line 35
$result
is the actual result you are looking for. Just loop through it and print the result. It is not the resource. You don't have to use any kind of fetch function