Display number of rows in mysql select
Posted: 20 Jan 2017, 09:15
Daily i have problems with my work today my problem is...
I try to build a Notification Popup i have for this a script what seems to work
but when i add a code i getting the numbers 1 2 3 4 from the 4 records from this user-id
but i would like to see only the total number (4)
I try to build a Notification Popup i have for this a script what seems to work
but when i add a code i getting the numbers 1 2 3 4 from the 4 records from this user-id
but i would like to see only the total number (4)
Code: Select all
<?php
$q=mysqli_query($conn,"select * from notice where user='".$_SESSION['user']."'");
$rr=mysqli_num_rows($q);
if(!$rr)
{
echo "<h2 style='color:red'>No any notice for You !!!</h2>";
}
else
{
$i=1;
while($row=mysqli_fetch_assoc($q))
{
echo "<Tr>";
echo "<td>".$i."</td>";
echo "</Tr>";
$i++;
}
?>
</table>
<?php }?>