Jump to content

Managing results from odbc_fetch_array


JBRTaylor

Recommended Posts

Hi

As a beginner after much work i managed to display the results of a call to an access database as a list and have quite happy managed to get them to display as a list in a table. Below is the code i have used to do this.

while($row = odbc_fetch_array($UserProdResults))
{
echo $row['ProductionName'] . "<br>";
} 
What i would like to be able to do is to populate each cell of a table which is 3 columns wide with the results eg:
 
Result 1   result 2   Result 3
Result 4   Result 5  Result 6
Result 7   etc....
 
At the moment i have only been able to populate the one column.
 
Any help / advice very gratefully received.
 
Jon
Link to comment
Share on other sites

To elaborate on Barand's offering:

 

In your loop you need to build an html table row only once for every 3 times thru the loop.  So you conduct the test he gave you and if it equals zero, you output the start row tag (after first checking if you have a row already started) and then output the td tag with that occurrence of data.  Then you increment the rowcount var and loop again.  This time the test will fail, so you only output the td tag.    

 

Play with it and you'll figure out the little things as you do

Link to comment
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.