Pavlos1316 Posted May 23, 2011 Share Posted May 23, 2011 Hello, This the dynamic list code that I use to display data from my db: $dynamicListBody = ""; $sql = mysql_query("SELECT * FROM products WHERE category='Body' ORDER BY id ASC"); $productCount = mysql_num_rows($sql); // count the output amount if ($productCount > 0) { while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $product_name = $row["product_name"]; $details = $row["details"]; $price = $row["price"]; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); $dynamicListBody .= ' <table width="95%"> <tr> <td width="10%"> <img style="border:#666 1px solid;" src="../stock_photos/' . $id . '.png" alt="' . $product_name . '" /> </td> <td width="35%"> <span class=itmttl>' . $product_name . '</span> <br /> <span class=text>' . $details . ' <br /> €' . $price . '</span> <br /> <form id="bd_itm1" name="bd_itm1" method="post" action="help_scripts/cart_functions.php"> <input type="hidden" name="pid" id="pid" value="<?php echo $id; ?>" /> <input type="submit" name="button" id="button" value="Add to Cart" /> </form> </td> <td width="5%"> </td> <td width="10%"> </td> <td width="35%"> <br /> <form id="bd_itm1" name="bd_itm1" method="post" action="help_scripts/cart_functions.php"> <input type="hidden" name="pid" id="pid" value="<?php echo $id; ?>" /> <input type="submit" name="button" id="button" value="Add to Cart" /> </form> </td> </tr> </table>'; } It puts my data only on the left column like 1 aaa 2 bbb 3 ccc What should I add to make it inserting data into my 2nd column on the row like: (?) 1 aaa | 2 bbb 3 ccc | 4 ddd 5 eee |... Thank you Link to comment https://forums.phpfreaks.com/topic/237195-display-data-in-dynamic-list/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 23, 2011 Share Posted May 23, 2011 To output data in multiple columns, see this link - http://www.phpfreaks.com/forums/index.php?topic=95426.0 Link to comment https://forums.phpfreaks.com/topic/237195-display-data-in-dynamic-list/#findComment-1219023 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.