Jump to content

echo a comma only if field is not blank?


jeff5656

Recommended Posts

I want to echo a comma and space (&nbsp) between variables, but if the field is null (blank) I do not.  I have 8 variables dx1 all the way to dx8.  How do I do this here:

 

<?php echo "</td><td bgcolor='FFFFFF'>" .  $row['billing_lvl'] . "</td><td bgcolor='FFFFFF'>" . $row['dx1'] . ", " .$row['dx2'] . ", " . $row['dx3'] . ", " . $row['dx4'] . ", " . $row['dx5'] . ", " . $row['dx6'] . ", " . $row['dx7'] . ", " . $row['dx8'] . ", ";
   echo "</tr>";

Link to comment
https://forums.phpfreaks.com/topic/136841-echo-a-comma-only-if-field-is-not-blank/
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.