Lamez Posted July 11, 2008 Share Posted July 11, 2008 On my homepage you can delete the entrys, but I want it to display a default message when you delete them all, in other words how can I tell if the database is empty? The database is structured like this: ID TITLE CONTENT and here is my whole code so far <?php $path = ""; $title = "Home"; $ban = "no"; $rank = "yes"; include ($path."main/include/cons/head.php"); $sql = mysql_query("SELECT * FROM `home` ORDER BY `id` DESC"); if($row['id'] < 1){ echo "nothing here"; } while($row = mysql_fetch_array($sql)){ echo "<p class=\"header\">".$row['title']; if($session->logged_in){ echo " <font size='2'><a href=".$path."main/include/dele_top.php?cmd=delete&id=".$row['id'].">Delete Topic(".$row['id'].")</a></font>"; } echo "</p><p class=\"maintext\">"; echo $row['content']; echo "</p>"; } include ($path."main/include/cons/foot.php"); ?> it displays nothing here, even when there is something there. Any Fixes? Link to comment https://forums.phpfreaks.com/topic/114193-solved-database-empty/ Share on other sites More sharing options...
realjumper Posted July 11, 2008 Share Posted July 11, 2008 Surly.... $sql = mysql_query("SELECT * FROM `home` ORDER BY `id` DESC"); $num_rows = mysql_num_rows($sql); if($num_rows < '1'){ echo "nothing here"; } Link to comment https://forums.phpfreaks.com/topic/114193-solved-database-empty/#findComment-587155 Share on other sites More sharing options...
Lamez Posted July 11, 2008 Author Share Posted July 11, 2008 lol I see my dumb mistake, there. Thanks Link to comment https://forums.phpfreaks.com/topic/114193-solved-database-empty/#findComment-587157 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.