Jump to content

check if php variable is empty


bob2006

Recommended Posts

i am pulling the login date from the databases and i want it to check if the variable is empty and if it is echo Never Loged In and if it not empty echo the date

          <?php
          include'db.php';
	  $id=$_GET['id'];
	  $sql=mysql_query("SELECT * FROM admin WHERE id='$id'")or die(mysql_error());
	  while($row=mysql_fetch_array($sql))
	  {
	  $date=$row['login_date'];
	  if($date > 0)
	  {
	  echo"Never Loged In";
	  }
	  else
	  {
	  echo"$date";
	  }
	  }
	  ?>

Link to comment
https://forums.phpfreaks.com/topic/221460-check-if-php-variable-is-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.