Page 1 of 1

No data being displayed on the page

Posted: Thu Apr 21, 2005 5:41 am
by Jim_Bo
Hi,

With the following code .. nothing is being displayed to the browser .. not even the plain text:

Code: Select all

<?php

require '../db.php';

$sql = "SELECT * FROM table WHERE id ='1'";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$id = $row['id']; 
$name = $row['name']; 

?>


<table width="51%" border="0" align="center" cellpadding="4" cellspacing="4">
  <tr>
    <td>

<?php
if ($_SESSION['user_level'] == 5) {
?>


<div align="center"><a href="../index.php?pages=page&id=<?php echo $row['id']; ?>">EDIT</a><br>

<?php

} else {

}

?>
      	
	  </div>
    </td>
  </tr>
  <tr>
    <td>
      <div align="center"><?php echo $row['name']; ?> Bla</div>
    </td>
  </tr>
</table>

<?php
}
?>
Stumped ..

Thanks

Posted: Thu Apr 21, 2005 5:49 am
by JayBird
change

Code: Select all

$result = mysql_query($sql);
to

Code: Select all

$result = mysql_query($sql) or die(mysql_error());
See what happens!

Posted: Thu Apr 21, 2005 5:55 am
by Jim_Bo
Hi,

Still blank page .. I know the query it correct .. still at the least "bla" should be showing on the screen.

thanks

Posted: Thu Apr 21, 2005 6:04 am
by JayBird
Jim_Bo wrote:still at the least "bla" should be showing on the screen.
not if the script never enters the while loop!

Make sure your query is returning some results!

Posted: Thu Apr 21, 2005 6:13 am
by Jim_Bo
Hi,

Doh table has been flushed .. no records :oops:

Cheers