Jump to content

ignore NULL values


daryltoogood

Recommended Posts

I have a page which gets email addresses from a MYSQL database and prints them with a ; between. 

 

echo $row_rs_units['train_email'].";";

 

Some entries don't have an email address, so only a ; is printed.

 

How could I ignore the NULL values?

 

I have tried the following, but it gives the same result as before

 

		if ($row_rs_units['train_email']==NULL)
		  {echo "";} 
		  elseif ($row_rs_units['train_email']==!NULL)
		  {echo $row_rs_units['train_email'].";";}

Link to comment
https://forums.phpfreaks.com/topic/195989-ignore-null-values/
Share on other sites

Thanks for the two different ways to achieve the same thing, they both work well!

 

I have noticed that in the source code there is a large amount of white space between each email address.  I assume that this white space will be ignored by the send email script that I am running?

Link to comment
https://forums.phpfreaks.com/topic/195989-ignore-null-values/#findComment-1029865
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.