Jump to content

Format Output


inspireddesign

Recommended Posts

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

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.