I am trying to put an if condition like <?php if($page===$x) {echo ' class="selected"';}?>
to use CSS for marking the selected page in my pagination for the following code:
<?php
$result = $DB_con->query('SELECT COUNT(*) FROM tbl_users');
$totalRecords = $result->fetchColumn();
$totalPages = max(1, ceil($totalRecords / $recordsPerPage));
for ($i=1; $i<=$totalPages; $i++) {
echo "<span class='navigations_items_span'>";
//if($page===$i) echo "<b>Visiting Page</b>";
echo "<b>Page </b>";
echo "<a href='index3.php?page=".$i."' class='navigation_item selected_navigation_item'>. ".$i.".</a>";
echo "</span>";
};
?>
I wanted to place in the line : echo "<a href='index3.php?page=".$i."' class='navigation_item selected_navigation_item'>. ".$i.".</a>";
but getting error each time, how to place if here?
please help.