OZONE Asylum
Forums
Server-Side Scripting - Oh my!
php loop through database and limit number of entries?
This page's ID:
30920
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Going to try to explain this as best I can. I have a bunch of stuff in a database and I need to display this info within a table. This isn't a problem at all but, I need it to only display 3 td tags per line and then move on to the row. so i need it to do : [code] <table> <tr> <td>My First Row</td> <td>My First Row 2</td> <td>My First Row 3</td> </tr> <tr> <td>My Second Row</td> <td>My Second Row 2</td> <td>My Second Row 3</td> </tr> </table> [/code] and continue to do this through every entry in the database table. so I have something like this that will display the info: [code] for ($i = 1; $i <= $num; $i++){ $chairArray = mysql_fetch_array($chairResult); $chairName = $chairArray['name']; $chairDescription = $chairArray['description']; $chairImage = $chairArray['image']; echo "<tr>"; echo "<td>"; echo "<img src=\"images/catalog/ottomans/thumbs/$chairImage\" width=\"157\" height=\"147\" />"; echo "<br />"; echo $chairName; echo "</td>"; echo "</tr>"; } [/code] Rough example ;) So how can I make it do something like what I have and only display 3 per line? Thanks in advance!!! Later, C:\ [small](Edited by [url=http://www.ozoneasylum.com/user/1079]CPrompt[/url] on 03-19-2009 02:02)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »
Maximum Security
OZONE
DHTML/Javascript
Server-Side Scripting - Oh my!
CSS - DOM - XHTML - XML - XSL - XSLT
Stupid Basic HTML
Visual Therapy
Photoshop
Photoshop Pong, Anyone?
***WARNING*** BIG SIG APPROACHING
Photography
3D Modelling & Rendering
Multimedia/Animation
Print Graphics
Holding Pens
Philosophy and other Silliness
Outpatient Counseling
Site reviews!
Mad Scientists' Laboratory
Getting to know the Grail