inspireddesign Posted July 2, 2009 Share Posted July 2, 2009 Hello everyone, I have a small problem that I can't seem to figure out but I'm sure there's a way to accomplish what I'm trying to achieve. Here's my problem: I have a table that has contact information that I want to place in a single string but format the output in the following manner. John Doe Richard Smith 124 S Main Street 1001 N Liberty Dr. Mount Vernon, Ohio 43050 New Jersey, NY 23334 Jane Smith Damian Clem 133 N Main Street 2222 N Liberty Dr. Mount Vernon, Ohio 43050 New Jersey, NY 23334 So, the output has two columns of data. I can't figure out how the loop would be handled to create the two columns. From left to right the loop would create contact one information > contact two information > next line > contact three info > contact four > until $contactinfo has no data left to display. <? while ($contactinfo = mysql_fetch_assoc($contacts)) { $output = ' ' .$contactinfo['first_name']. ' ' .$contactinfo['last_name']. '\n'; $output .= ' ' .$contactinfo['street']. '\n'; $output .= ' ' .$contactinfo['city']. ' '. .$contactinfo['state']. ' ' .$contactinfo['zip'].'\n\n'; } ?> Thanks for any help provided on this one. Link to comment https://forums.phpfreaks.com/topic/164546-format-output/ Share on other sites More sharing options...
Maq Posted July 2, 2009 Share Posted July 2, 2009 Why aren't you using CSS or a table? Link to comment https://forums.phpfreaks.com/topic/164546-format-output/#findComment-867923 Share on other sites More sharing options...
inspireddesign Posted July 2, 2009 Author Share Posted July 2, 2009 The output is going into a RTF Word doc. How would you handle this with tables (cells)? Link to comment https://forums.phpfreaks.com/topic/164546-format-output/#findComment-868001 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.