A few things, as with the below changes, it works with data coming back. I faked the logged_in()
function by always returning true.
First thing, you had a semi-colon after your while right away. So that was bad. I put the ending </table>
outside the while block.
Also, stay away from select *
. Spell out the column names. And I suggest you use the column names and not ordinal values upon using them in the result set.
Also, move to mysqli
or pdo
. Jay gave you links to them above in comments.
$dbname = 'myDB';
$dbuser = 'GuySmiley';
$dbpass = 'anchovies';
$dbhost = 'localhost';
$link = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
mysql_select_db($dbname) or die("Could not open the db '$dbname'");
if(logged_in() === true){
$q=mysql_query("select * from `admin` order by `id` desc");
if($q === FALSE) {
die(mysql_error()); // this is for non-production code
}
echo "<table cellspacing=0 cellpadding=0 border=1><tr><td>Id</td><td>User</td><td>Password</td><td>Permission</td><td>delete</td><td>edit</td></tr>";
while($date=mysql_fetch_row($q))
{
echo "<tr><td>{$date[0]}</td><td>{$date[1]}</td><td>{$date[2]}</td><td>{$date[3]}</td><form method=post action=delete.php><td><input type=hidden name=id value='{$date[0]}'><input type=submit name=sterge value=delete></td></form><form action=edit.php method=get><td><input type=hidden name=id value='{$date[0]}'><input type=submit name=edit value=edit></td></td></form></tr>";
}
echo "</table>";
}
else {
echo "you are not logged in<br>";
}

So it outputs your data (and by turning on error reporting, developing code is a lot easier).
Turn on error reporting
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
Develop with non-deprecated mysql libraries with code wrapped in exception handling
By the way, schema for above test is
create table admin
( id int auto_increment primary key,
col1 int not null,
col2 int not null,
col3 int not null
);
insert admin (col1,col2,col3) values (11,111,1111),(22,222,2222);