View Single Post
  #1 (permalink)  
Old 11-02-09, 01:14 PM
topsidemarketing topsidemarketing is offline
Newbie Coder
 
Join Date: Aug 2009
Posts: 23
Thanks: 4
Thanked 0 Times in 0 Posts
rookie question about blank fields

Hi guys,

I'm successfully pulling data from the MySQL database and displaying the output in an HTML table using 'echo $_variable' within the table tags. This is working famously.

My only problem is that in just a few cases in the database records, one of the fields has been left blank or empty and that blank field leaves an obvious white space (empty table row) in the output table - example: If all the fields have content, the display looks like this:

Company name
Contact name
Address 1
Address 2
City, State Zip

And that's fine. However, if, for example, the 'contact name' field is blank in the database, the output will look like this:

Company name

Address 1
Address 2
City, State Zip.

Is there a way, using the PHP in the display page, to get the output to skip the blank field altogether, so that with a blank 'contact name' field, the output will be:

Company name
Address 1
Address 2
City, State zip...

with no blank table row where the contact name should be?

I suspect this is a rookie question and that there's an easy fix, but don't know what it should be.

THANKS in advance...all help appreciated!
Reply With Quote