Conditional Query

Hello! Why is nothing displayed in the browser?

<?php
require_once("config.php");
$num=5;
$result=mysql_query("SELECT*FROM gb");
$chislo=mysql_num_rows($result);
if($chislo>$num) {
    while($res = mysql_fetch_assoc($result)) {     
        echo ''.$res['name'].'<br>'.$res['message'].'<hr>'; 
    }
    echo '<a href=?pages=1></a>';
}
?>

There is a connection to the database, if you do not set if, then everything works, but it does not. Why?


Answer 1

Obviously, the number of lines is less than 5 or equal to 5 and the condition is not met?


Answer 2

Try turning on error display, if it’s off, look at which line it crashes.

<?php 
 error_reporting(E_ALL); 
 ini_set("display_errors", 1); 
?>

Leave a reply

Please enter your comment!
Please enter your name here