Rifts Posted July 17, 2010 Share Posted July 17, 2010 Hey I'm pulling data from my database and echoing it like so echo $row['chx1'] . "<br>"; echo $row['chx2'] . "<br>"; echo $row['chx3'] . "<br>"; echo $row['chx4'] . "<br>"; echo $row['chx5'] . "<br>"; echo $row['chx6'] . "<br>"; echo $row['chx7'] . "<br>"; echo $row['chx8'] . "<br>"; echo $row['chx9'] . "<br>"; echo $row['chx10'] . "<br>"; but it results in this if a chx# is blank bla bla bla bla doing this causes a lot of white space if the field is blank in my database so how can I put them on different lines and not skips spaces like bla bla bla bla Thanks Link to comment https://forums.phpfreaks.com/topic/208051-super-simple-echo-question/ Share on other sites More sharing options...
kenrbnsn Posted July 17, 2010 Share Posted July 17, 2010 Do something like this: <?php for ($i=1;$i<11;++$i) { if ($row['chx' . $i] != '') { echo $row['chx' . $i] . "<br>\n"; } } ?> Ken Link to comment https://forums.phpfreaks.com/topic/208051-super-simple-echo-question/#findComment-1087561 Share on other sites More sharing options...
Rifts Posted July 17, 2010 Author Share Posted July 17, 2010 Your a pimp thanks a mill Link to comment https://forums.phpfreaks.com/topic/208051-super-simple-echo-question/#findComment-1087568 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.