PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Jim_Bo
Forum Contributor
Posts: 390 Joined: Sat Oct 02, 2004 3:04 pm
Post
by Jim_Bo » Thu Apr 21, 2005 5:41 am
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
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Thu Apr 21, 2005 5:49 am
change
to
Code: Select all
$result = mysql_query($sql) or die(mysql_error());
See what happens!
Jim_Bo
Forum Contributor
Posts: 390 Joined: Sat Oct 02, 2004 3:04 pm
Post
by Jim_Bo » Thu Apr 21, 2005 5:55 am
Hi,
Still blank page .. I know the query it correct .. still at the least "bla" should be showing on the screen.
thanks
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Thu Apr 21, 2005 6:04 am
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!
Jim_Bo
Forum Contributor
Posts: 390 Joined: Sat Oct 02, 2004 3:04 pm
Post
by Jim_Bo » Thu Apr 21, 2005 6:13 am
Hi,
Doh table has been flushed .. no records
Cheers