I am getting the errors:
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in /home/www/thetotempole.ca/phpimageupload/pagecounter.php on line 19
title   bodytext
Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in /home/www/thetotempole.ca/phpimageupload/pagecounter.php on line 32
when I try to run my PHP page. I am expecting this problem is originating from either the $sql or the $connection. I don't believe it is my $connection because all of my variables are correct and I am not getting a connection error. The code is supposed to display my MySQL table's data four rows per page. After four rows have been displayed it will create a new page for the next four rows, and so on.
Here is my full PHP page's code:
<?php 
if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; }; 
$dbhost = 'ddm';
$dbuser = 'kdm';
$dbpass = 'Kder';
$dbname = 'kegbm';
$connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
if(! $connection )
{
  die('Could not connect: ' . mysqli_error());
}
$start_from = ($page-1) * 4; 
$sql = 'SELECT * FROM `testdb` ORDER BY `created` ASC LIMIT "'.$start_from.'",4';
$rs_result = mysqli_query ($connection, $sql); 
echo mysqli_error( $connection );
?> 
<table>
<tr><td>title</td><td>bodytext</td></tr>
<?php 
while ($row = mysqli_fetch_assoc($rs_result)) { 
?> 
            <tr>
            <td><? echo $row["title"]; ?></td>
            <td><? echo $row["bodytext"]; ?></td>
            </tr>
<?php 
}; 
?> 
</table>
<?php 
$sql = "SELECT COUNT(`created`) FROM `testdb`";
$rs_result = mysqli_query($connection, $sql); 
$row = mysqli_fetch_row($rs_result); 
$total_records = $row[0]; 
$total_pages = ceil($total_records / 4); 
for ($i=1; $i<=$total_pages; $i++) { 
            echo "<a href='pagination.php?page=".$i."'>".$i."</a> "; 
}; 
?>
 
     
     
    