jeff5656 Posted December 13, 2008 Share Posted December 13, 2008 I want to echo a comma and space ( ) 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 More sharing options...
rarebit Posted December 13, 2008 Share Posted December 13, 2008 $name = "c"; print "Hello ".(empty($name)==FALSE ? $name : "x").", How you doin!<br>"; something along those lines... (i've just re-read your post and the exact requirement isn't that but can be rearranged to...) Link to comment https://forums.phpfreaks.com/topic/136841-echo-a-comma-only-if-field-is-not-blank/#findComment-714811 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.