Jump to content

[SOLVED] Database Empty?


Lamez

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.