Jump to content

Recommended Posts

I am trying to output my loop data into two columns, not duplicated in two columns but basicly like this....

 

 

first row    second row

 

third row    forth row

 

fifth row    sixth row

 

 

etc.

 

 

As it is now my script querys my databse, grabs all the fields, and puts all the fields for id 1 on one line, then it loops to the next one and puts the next id's (id 2) fields all on the next line, and so on. I want to format the data in tables (well its already formated) but when it loops I don't want them being output one above the other I want the first id's data to display in one table, then next to it output the next line (line 2), then have it break to a new line, which will be the same, the first part of that one will be line3, then line 4. Any ideas? I have thought about maybe doing one loop statement for odd numbers and have hat display in a cell, keeping all of the odds on one side of the page, then doing even in a cell next to it which would have all the evens go on the opposite side of the page. The only problem is some of the fields are skipped since it pulls the data based on whether the id is active, etc. So that would end up being out of sequence. I want to be able to print the output to hardcopy and a person can read it going from left to right then down to the next line, left, and right, then down again, etc. but remaining the data in sequence so they see the ids and all the ids data as follows...

 

 

 

----------------------------------------------------

|                                  |                                  |

|    id1, name, date, etc.  |  id2, name, date, etc.  |

|                                  |                                  |

|---------------------------------------------------

|                                  |                                  |

|    id3, name, date, etc.  |  id4, name, date, etc.  |

|                                  |                                  |

|---------------------------------------------------

|                                  |                                  |

|    id5, name, date, etc.  |  id6, name, date, etc.  |

|                                  |                                  |

|---------------------------------------------------

|                                  |                                  |

|    id7, name, date, etc.  |  id8, name, date, etc.  |

|                                  |                                  |

|---------------------------------------------------

|                                  |                                  |

|    id9, name, date, etc.  |  id10, name, date, etc. |

|                                  |                                  |

|---------------------------------------------------

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/75765-putting-loop-data-in-2-columns/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.