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 put if, then everything works, but it does not. Why?

  • Do you need more than five elongated records from the database? Then: if (mysql_num_rows ($ result)> $ num) {/ *, etc. * /} - Deonis
  • one
    Cool variables named ^ _ ^ - mikh
  • one
    Uh-huh)) Goann never get confused between $ result and $ res, $ chislo and $ num;) - Deonis

2 answers 2

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

  • ATP, yes, I completely forgot about it) - lars

Try to turn on the display of errors if turned off, look at which line falls.

 <?php error_reporting(E_ALL); ini_set("display_errors", 1); ?> 
  • No matter what. The code is executed successfully, only without output to the browser due to incorrect program logic. - ReinRaus