Not Showing All Results
I have a script that is simply supposed to show all links in the database. For some reason, it does not show the newest link in the table. Here is my code:
PHP Code:
<?php
$level = $_SESSION['level'];
########## If No Action ##########
if (!$_GET['act'] && !$_POST['delete']) {
if ($level < 1) { die('<meta http-equiv="refresh" content="2;URL=index.php" /> <div class="error">You do not have permission to access this page</div>'); } else {
$get = mysql_query("SELECT * FROM `links` ORDER BY id DESC") or die ("Error Getting Users! \n<br />\n" .mysql_error());
$u = mysql_fetch_array($get);
$chk = mysql_num_rows($get);
// If No Resuts
if ($chk < 1) { echo('No links at this time.'); } else { $count = 1; $color = $col1; ?>
<b>Navigation:</b> <a href="add.php">Add New Link</a> <br />
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<table width="500" align="center" class="admin_table">
<tr bgcolor="<?php echo $col3 ?>">
<td>ID</td>
<td>Title</td>
<td>URL</td>
<td>View Level</td>
<td>Edit</td>
<td>Delete</td>
</tr>
<?php while ($u = mysql_fetch_array($get)) { $l = parse_url($u['url']); ?>
<tr bgcolor="<?php echo $color ?>">
<td><?php echo $u['id'] ?></td>
<td><?php echo $u['title'] ?></a></td>
<td><a href="<?php echo $u['url'] ?>" target="_blank"><?php echo $l[path] ?></a></td>
<td><?php echo $u['viewLvl'] ?></td>
<td><a href="?act=edit&id=<?php echo $u['id'] ?>"><img src="../../images/edit.png" alt="Edit" border="0" /></a></td>
<td><input type="checkbox" name="checkbox[]" value="<?php echo $u['id'] ?>" /></td>
</tr>
<?php ++$count; if ($color == $col1) { $color = $col2; } else {$color = $col1; }
} ?>
</table>
</form>
<?php
}
}
}
?>
I don't see anything that should cause this. Anyone know what is going wrong? Thanks
Thanks DD, you saved me countless times
Bookmarks