Jump to content

[SOLVED] If Statement To Select a Non Emtpy Table Cell


TecTao

Recommended Posts

I have decided to use an If / Else statement which has an argument that is determined if one table cell is empty any data or not.

 

this is what I have as the If portion.

 

if ( $med_yt_code > '0' ) {

Stuff}

Else

{the other stuff}

 

so if the table cell med_yt_code is empty,  then the Else portion will display, otherwise the stuff in the med_yt_code will display.

 

If anyone has any better suggestions on determining if a table is is empty in an If/Else, i'm interested in your suggestions.

 

Thanks in advance,

Michael Conway

www.TecTaoDesigns.com

I'm assuming that the variable $med_yt_code is being echoed into the table cell. If that is the case, you'd be better off checking it like this:

 

if(!empty($med_yt_code)) { 
stuff
} else {
the other stuff
}

That will check if the variable is empty instead of greater than 0, which is probably closer to what you're looking for.

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.