PHP isset - Issue

Hi Guys,

I’m doing a query in MySQL and doing if theres data in the row of a field then echo the text out. But for some reason its echoing even if there is no text in the field. Any help would be great, iv checked the database and logged into MySQL Workbench to make sure there was no spaces and theres not but its still echoing the text for some reason.

<?php
// Quote variable to make safe
function quote_smart($value)
{
   // Stripslashes
   if (get_magic_quotes_gpc()) {
       $value = stripslashes($value);
   }
   // Quote if not a number or a numeric string
   if (!is_numeric($value)) {
       $value = "'" . mysql_real_escape_string($value) . "'";
   }
   return $value;
} // end make safe

$postcode=$_GET["postcode"];

require("./databaseconnection.php"); //Get Database Login Information

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Oops theres an error, our highly trained monkeys have been notified.");

$query = sprintf("SELECT * FROM PAF WHERE Postcode LIKE %s",
			quote_smart($postcode));
//echo $query;
mysql_query($query) or dies(mysql_error());
$result = mysql_query($query);

?>
<select name="addressbox" id="addressbox" style="width:285px;" onchange="AddressPicked();">
<option value="">Select address here...</option>
<?
while($row = mysql_fetch_array($result))
  {
		
	
?>
  <option value="<? echo $row['postcode']; ?>"><? 		
		
		

  if(isset($row['Organisation_Name']))
        {
			echo $row['Organisation_Name']. ", ";
		};
		if(isset($row['Building_Name']))
        {
			echo $row['Building_Name']. ", ";
		};
		if(isset($row['Building_Number']))
        {
			echo $row['Building_Number']. ", ";
		};
		if(isset($row['Dependent_Thoroughfare']))
        {
			echo $row['Dependent_Thoroughfare']. ", ";
		};		
		if(isset($row['Thoroughfare']))
        {
			echo $row['Thoroughfare']. ", ";
		};
		if(isset($row['Post_Town']))
        {
			echo $row['Post_Town']. ", ";
		};
		if(isset($row['Dependent_Locality']))
        {
			echo $row['Dependent_Locality']. ", ";
		};
		if(isset($row['Postcode']))
        {
			echo $row['Postcode']. " ";
		};


  ?></option>
  <?
  }
 ?>
 </select>

check a var_dump($row[‘postcode’]);
It may be set but empty.
If so, use !empty($row[‘postcode’])

Thank you, the !empty has worked a treat :slight_smile: