I am trying to find a way to refresh the count on a class after a successfull mysql update. At the moment I am using a class to display the information and for styling and this works well on page load. Is is possible to refresh a class after update. $ni; stores the result after mysql count.
I have attached the code I am using and would be grateful for any advice. Thanks
html
<ul>
<li>
<a href="/domain/admin/test.php" title="Add">New Intake <span class="notification" style="float: right;"><?php echo $ni; ?></span></a>
</li>
</ul>
php
<?php
$sql = mysqli_query($conn, "SELECT count(*) as total FROM act WHERE new = '1'"); // provide db connection object as first parameter
$rows = mysqli_fetch_assoc($sql);
$num = $rows['total'];
$ni = $num;
if ($ni < 1) {
$ni = '0';
}
?>