tsiedsma Posted March 10, 2006 Share Posted March 10, 2006 I have some data in a database I want to display in 2 columns. How can I accomplish this?[code]<?include 'dbax.php';$result = mysql_query("SELECT * FROM locations ORDER BY name ASC");$myrow = mysql_fetch_array($result);if (!$result) { die('Could not view record:' . mysql_error()); } if ($myrow = mysql_fetch_array($result)) {$itemsPerRow = 2;$count = 0;while($row = mysql_fetch_array($result)) { if ($count % $itemsPerRow == 0) $count++;//echo <td> tags and array $row[whatever] data here.}echo "</table>";} else { echo "<p><strong>There is currently no information in the database.</strong></p><br>"; }mysql_free_result($result);mysql_close();?>[/code]I have 9 rows I need displayed for each group. I want the groups of data to be 2 across and 2 or 3 rows down. I would also like to add a next link or button to view the next group of data.Here is a quick example of what I am wanting it to look like:[a href=\"http://img163.imageshack.us/my.php?image=image1tm.gif\" target=\"_blank\"][img src=\"http://img163.imageshack.us/img163/1310/image1tm.th.gif\" border=\"0\" alt=\"IPB Image\" /][/a] Quote Link to comment Share on other sites More sharing options...
mem0ri Posted March 10, 2006 Share Posted March 10, 2006 Sounds like a simple HTML formatting issue...[code]<table> <tr> <td>data1</td> <td>data2</td> <tr><!--Repeat for as many rows as you like with those two columns--></table>[/code]Since getting data from the database doesn't seem to be an issue for you, I'll leave that part to you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.