PHP - Php Results Into Columns
Hello - hope you are all well.
I am creating a website for a family friend who has a shop. See preview of the site in this picture ....
Picture1.jpg 40.32KB
0 downloads
Currently the results are showing in one column. I want to show them in three columns in the format of:
1 2 3
4 5 6
7 8 9 etc
But formatted with the picture and then the title and the border.
The current code i have is....
HEAD
<?php
$sql = "SELECT * FROM abs_productcat WHERE catid = $catid ORDER BY catid ASC";
$can = mysql_query($sql); $catname = mysql_fetch_assoc($can); ?> BODY <?php while ($row_pro = mysql_fetch_assoc($rs_proddetails)) { ?><tr> <td><table width="243" border="0" align="left" cellpadding="15" cellspacing="0" class="sectionborders"> <tr> <td height="120" align="center"><p><strong><a href="indproducts.php?ProductID=<?php echo $row_pro['ProductID']; ?>"><img src="products/product_<?php echo $row_pro['ProductID']; ?>" alt="<?php echo $row_pro['ProductName']; ?>" height="120" class="sectionborders" border="0" /></a></strong></p> <p><strong><a href="indproducts.php?ProductID=<?php echo $row_pro['ProductID']; ?>" class="products"><?php echo $row_pro['ProductName']; ?></a></strong></p></td> </tr> </table></td> </tr> <tr> <td> </td> </tr> <?php } ?> THANK YOU FOR YOUR HELP!!! Similar TutorialsHi I have a page which returns 2 rows of images max 5 in each. Code is: <?php $query = mysql_query("SELECT COUNT(id) FROM " . $prev . "pics where id=" . $id . ""); list($number_records) = mysql_fetch_row($query); if ($number_records >= 10 ) { $number =10; //LIMIT IMAGES TO 10 } else { $number =$number_records; } echo "<br />"; echo "Displaying $number of $number_records images"; ?> <div class="thumb-right"> <dl> <?php for ($i = 0; $i < 5; $i++): ?> <dt> <img src="../pics/<?php echo $images[$i]; ?>" alt="" width="120" height="120" class="border1" /><br /><br /> </dt> <?php endfor; ?> </dl> </div> <div class="thumb-left"> <dl> <?php for ($i = 5; $i < $number; $i++): ?> <dt> <img src="../pics/<?php echo $images[$i]; ?>" alt="" width="120" height="120" border="0" class="border1" /><br /><br /> </dt> <?php endfor; ?> </dl> </div> This works fine if there are 10 images to display, but on occasions there may only be 7 for instance. This then puts 5 in the right column and only 2 in the left column which looks ugly. Can someone suggest a way of calculating the total number of images and then displaying them say 4 in the left column and 3 in the right column for this example? Thanks for your time GT Code: [Select] <?php $result = mysql_query("SELECT * FROM FamilyTbl INNER JOIN PeopleTbl ON (FamilyTbl.Name_ID = PeopleTbl.NameID) WHERE FamilyTbl.House_ID = '$address' ORDER BY NameLast, NameFirst ") OR die(mysql_error()); WHILE ($row = mysql_fetch_array($result) ) { echo $row[NameLast]. ", ". $row[NamePrefix]. " ". $row[NameFirst]. " ". $row[NameMiddle]. $row[NameSuffix]. " "; } ?> OK, some of these queries return A LOT of names. I'd like to be able to display them in columns in a table like so: Code: [Select] Charne, Mr. Michael Glanger, Mrs. Karin Kling, Mr. Wayne Charne, Mrs. Suzette Glanger, Mr. Trevor Lazarow, Mrs. Fiona Charney, Mrs. Linda Jochelson, Mrs. Barbara Lazarow, Mr. Mark Charney, Mr. Norman Jochelson, Mr. Neil Norton, Mr. Charles Cohen, Mr. Brendan Karlan, Mr. Dennis Norton, Mrs. Jodi Cohen, Mrs. Joanna Karlan, Mrs. Helen Roy, Mr. Michael Flekser, Mrs. Jean Kling, Mrs. Danielle Roy, Mrs. Nicki Frysh, Dr. Howard Kling, Mrs. Melanie Tsafrir, Mrs. Lauren Frysh, Mrs. Sandra Kling, Mr. Nevil Tsafrir, Mr. Thomer That way it reads top to bottom THEN left to right. math-wise, it's simple to set up: Code: [Select] $num_results = number_of_$results; $numcols = 3; $numrows = trunc($numresults/numcols); <table> for row_loop=1 to numrows <tr> for col_loop = 1 to numcols <td> echo result(col_loop-1)*(numrows)+row_loop </td> next col_loop </tr> next row_loop </table> Anyone want to give this a shot? Revraz already directed me to http://www.phpfreaks.com/forums/index.php/topic,95426.0.html but that displayed the data from left to right then up to down like so: Code: [Select] Charne, Mr. Michael Charne, Mrs. Suzette Charney, Mrs. Linda Charney, Mr. Norman Cohen, Mr. Brendan Cohen, Mrs. Joanna Flekser, Mrs. Jean Frysh, Dr. Howard Frysh, Mrs. Sandra Glanger, Mrs. Karin Glanger, Mr. Trevor Jochelson, Mrs. Barbara Jochelson, Mr. Neil Karlan, Mr. Dennis Karlan, Mrs. Helen Kling, Mrs. Danielle Kling, Mrs. Melanie Kling, Mr. Nevil Kling, Mr. Wayne Lazarow, Mrs. Fiona Lazarow, Mr. Mark Norton, Mr. Charles Norton, Mrs. Jodi Roy, Mr. Michael Roy, Mrs. Nicki Tsafrir, Mrs. Lauren Tsafrir, Mr. Thomer It's a good temp solution, but if anyone is good with for loops, I'd appreciate the help, thanks! -Dave Hi, This has been baffling me for a couple hours now and i cant seem to figure it out. I have some code which creates an array and gets info from a mysql database and then displays in a list. This works great but after adding more and more rows to my database the list is now becoming quite large and doesnt look great on my site. Is it possible to split the list into multiple columns of about 25 and if possible once 3 or 4 columns have been created start another column underneath. To help explain i would be looking at a layout as follows: Code: [Select] line 1 line 1 line 1 line 2 line 2 line 2 ... ... ... line 25 line 25 line 25 line 1 line 1 line 1 line 2 line 2 line 2 ... ... ... line 25 line 25 line 25Im guessing there should be some sort of if statement to check how many items are being displayed and to create a new column if necessary. Is this correct? Thanks, Alex Hi, I am stuck. I have used dreamweaver to create a master details page with links to the details page successfully, but I would like to display the master details page results in 3 columns rather than the 1 column that dreamweaver defaults. As the site becomes richer the content will increase yielding many results, therfore the content displayed in a single column will require the users to scroll way down the page. So, as it is now the results display as follows: Plant1 Plant2 Plant3 Plant4 Plant5 Plant6 Plant7 Plant8 Plant9 etc... I would like them to display as follows: Plant1 Plant4 Plant7 Plant2 Plant5 Plant8 Plant3 Plant6 Plant9 Here is my code thus far: <?php require_once('Connections/connGND.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_connGND, $connGND); $query_rsBotanicalA = "SELECT * FROM plants WHERE CatIDB = 'A'"; $rsBotanicalA = mysql_query($query_rsBotanicalA, $connGND) or die(mysql_error()); $row_rsBotanicalA = mysql_fetch_assoc($rsBotanicalA); $totalRows_rsBotanicalA = mysql_num_rows($rsBotanicalA); ?> <table border="0" align="left"> <?php do { ?> <tr> <td align="left"><a href="plantdetails.php?recordID=<?php echo $row_rsBotanicalA['PlantID']; ?>"> <?php echo $row_rsBotanicalA['BotanicalName']; ?> </a></td> </tr> <?php } while ($row_rsBotanicalA = mysql_fetch_assoc($rsBotanicalA)); ?> </table> Could someone help me to write this code, as I have been unsuccessful maintaining the links. I have been able get the results to display in the columsn as I would like, but I haven't been able to figure it out while maintaining the links! Thanks. hello, all: I'm a newbie, and been trying to work out a way so that the results from an array (or mysql recordset for that matter), are nicely aranged in a table. I want them to show in a grid-like manner, with rows and columns added according to number of "items". I worked out this small code snippet, with a sample array, and for the life of me, cant figure out how to make it so it automatically "breaks" columns at 5 and start new row. I got it to show me right number of rows, but then it repeats all 10 names within them, as opposed to just showing 5 names in each row... Appreciate the help... Code: [Select] <?php $names = array('Charles','Henry','Manny','Philip','Rose','Evelyn','Peter','Julia','Cary','Sophia'); $numberColumns = 5; $numberNames = count($names); $numberRows = ceil($numberNames / $numberColumns); echo "<table border='1' width='400' cellspacing='0' cellpadding='0'>"; for ($i=1; $i<=$numberRows; $i++) { echo "<tr>"; foreach ($names as $name) { echo "<td>" . $name . "</td>"; } echo "</tr>"; } echo "</table>"; ?> Hi All i am wanting a column list like this http://extensions.joomla.org/extensions basically the database is set up as (id, category, parent) I want the parent to group the category section and list like the the joomla example in three columns search various threads throughout the internet but none seem to cover this entirely can any one please help????? Is there a way to echo the results of a query as separate columns as opposed to one under the other? This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=359199.0 I have a 2 part question i hope is an easy Fix, i know very little about any of this, I have a list of teams that shows up and is is showing in ONE long column, i want to do to things, Make it multiple columns & sort alphabetically like this: 123 456 789 Here is the link to the test page right now http://tspclan.com/SS/test.php And the page code (top half of it anyways) Code: [Select] <?php require_once("global.php"); $id = htmlentities($_GET['id']); $order = mysql_real_escape_string($_GET['order']); if($order == "levela") { $order = "ORDER BY `defwin` ASC"; $l_pre = "<a href='?id=$id&order=leveld'>"; $l_suf = "</a>"; } elseif($order == "leveld") { $order = "ORDER BY `defwin` DESC"; $l_pre = "<a href='?id=$id&order=levela'>"; $l_suf = "</a>"; } else { $order = "ORDER BY `defwin` DESC"; $l_pre = "<a href='?id=$id&order=levela'>"; $l_suf = "</a>"; } $team = mysql_query( "SELECT * FROM `teams` WHERE `id`='".$id."'"); $t = mysql_fetch_array($team); $team_title = mysql_real_escape_string($t['title']); $t_tag = $t['tag']; $page1 = $t['page1']; $user = mysql_query( "SELECT * FROM `users` WHERE `team`='".$id."' $order"); ?> <script src="http://tspclan.com/js/fbid.js" type="text/javascript"></script> <script src="http://tspclan.com/js/pid.js" type="text/javascript"></script> <script src="http://tspclan.com/js/sorttable.js" type="text/javascript"></script> <title><?php echo $team_title; ?></title> </head> <link href="http://tspclan.com/mkportal/templates/TSP/style.css" rel="stylesheet" type="text/css" /> <body> <div align="center"> <?php if(mysql_num_rows($team) == false) { $team2 = mysql_query( "SELECT * FROM `teams`"); ?> <table width="100%" border="0" class="unsortable" cellspacing="0" cellpadding="0"> <tr> <td background="img/hdr_left.jpg"> </td> <td width="590"><div align="center"><img src="img/hdr.jpg" width="590" height="346" /></div></td> <td background="img/hdr_right.jpg"> </td> </tr> </table> <br><br> <table width="250" cellspacing="0" class="unsortable" cellpadding="5" border="0" id="mwid"> <tr> <td align="center" valign="top" class="index_title unsortable" col span="3" >Team Name</td> </tr> <?php while($t2 = mysql_fetch_array($team2)) { $t_name = "<a style='font-weight:bold; font color:#333333;' href='?id=".$t2['id']."'>".$t2['title']."</a>"; echo " <tr> <td valign='top' align='center' width='50' class='row1 b_t' style='border-bottom:none; width:5px; background-color:#333333;'>".$t_name."</td> "; } ?> 2nd Part of my question, When i call for a team my link is test.php?id=(team id) Is there a way to bring up multiple teams at the same time? Hey guys, I have made an array where only the name shows up, but I want the price next to it. I adapted the query, but how do I need to adapt the array? peace Code: [Select] <?php // connect to your database $DrinkArray=array() ; $DrinkResult=mysql_query("SELECT name,price FROM products")or die(mysql_error()); while($DrinkRow=mysql_fetch_assoc($DrinkResult)){ $DrinkArray[]=$DrinkRow['name']; } //check your output with something like this foreach($DrinkArray as $value){ echo $value.'<br />'; } ?> I am editing code to get sku numbers, for now it just prints as below: SKU: 123 SKU: 322 SKU: 444 SKU: 555 SKU: 666 I want to put them in columns so it prints as: SKU: 123 SKU: 322 SKU: 444 SKU: 555 SKU: 666 etc. etc. So it is devided into 4 columns. The code that controls is: Code: [Select] <?php if (is_array($order->products)) { $context = array( 'revision' => 'formatted', 'type' => 'order_product', 'subject' => array( 'order' => $order, ), ); foreach ($order->products as $product) { $price_info = array( 'price' => $product->price, 'qty' => $product->qty, ); $context['subject']['order_product'] = $product; $context['subject']['node'] = node_load($product->nid); ?> <?php echo $product->model; ?><br /> <?php } }?> i would appreciate some help I have a page that displays a list of retail locations (est. 100-150 locations). I have my layout setup to fit 3 columns side by side. Ex: <div class="col"></div> <div class="col"></div> <div class="col"></div> .. with the "col" class having a specific width and float: left. Basically, I want to print out the locations in the column and when a column reaches a certain number of locations, it closes that div and starts a new one and continues printing the rest of the locations. How would I go about making sure that once a column has reached a certain number of locations, it closes the div and starts the new one? I'm working on a site where I've implemented a simple back end wysiwyg editor for content on a page. Then on the public page I run a php query to pull that content and display it. But doing this cancels out the css I have been using to split content into two columns. Is there a way to do this in php, or is there a way to circumvent the problem? ( also tried echoing the entire css style along with the query result - that didn't work either) The <p id='container_sub'> is what is split into two columns. I tried it outside of the query, and inside the query around where I echo results. Neither worked. Here's the basic php code, and further down the css that makes two columns: Code: [Select] <?php $pageid = '2'; // Formulate Query // This is the best way to perform an SQL query // For more examples, see mysql_real_escape_string() $query = sprintf("SELECT content FROM tbl_pages WHERE page_id='%s'", mysql_real_escape_string($pageid)); // Perform Query $result = mysql_query($query); // Check result // This shows the actual query sent to MySQL, and the error. Useful for debugging. if (!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); } // Use result // Attempting to print $result won't allow access to information in the resource // One of the mysql result functions must be used // See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc. while ($row = mysql_fetch_assoc($result)) { echo "<p id='container_sub'>".$row['content']."</p>"; } // Free the resources associated with the result set // This is done automatically at the end of the script mysql_free_result($result); ?> The css.... Code: [Select] #container_sub {-moz-column-count: 2; -moz-column-gap: 25px; -webkit-column-count: 2; -webkit-column-gap: 20px; column-count: 2; column-gap: 20px;} #container_sub2 {-moz-column-count: 2; -moz-column-gap: 25px; -webkit-column-count: 2; -webkit-column-gap: 20px; column-count: 2; column-gap: 20px;} Hi all, This application is given me a nightmare. The code fetches root categories and its sub categories from the a database table. The div table have only 2 columns. I want to add 2 extra columns so that I have 4 columns. Because we have a long list of subcategories meaning I have to scroll down to view the category. Please help Code: [Select] {include file='t_javascript_language.tpl'} {set_css} {set_js} <!--<div class="componentheading">{$page_title}</div>--> <div class="adds_man_list"> <span>{$category_pathway}</span> {if $current_category->catname!=""} <div style="border:2px solid #000;"> {include file='elements/display_fields.tpl' position='categoryicon' this_add=$current_category->id} <strong>{$current_category->catname}</strong> <div class="adds_subcat" style="text-align:right;background:#F5F5F5; border:1px solid #FFFFFF; " > {include file='elements/display_fields.tpl' position='categorydetails' this_add=$current_category->id} <span style="font-size:12px;"> {jtext text="ADS_SUBCATEGORIES"}: {$current_category->kids} {jtext text="ADS_ADS"}: {$current_category->nr_ads} <a href="{$current_category->view}" title="{jtext text='ADS_VIEW_LISTINGS'}"> <img src="{$IMAGE_ROOT}view_listings.gif" class="ads_noborder" alt="{jtext text='ADS_VIEW_LISTINGS'}" /> </a> </span> </div> </div> {/if} {if $categories|@count<=0} <h2>{jtext text="ADS_NO_CATEGORIES_DEFINED"}</h2> {/if} <table id="adds_categories" class="ads_table"> {section name=category loop=$categories} {if $smarty.section.category.rownum is odd} <tr> {/if} <td width="50%" class="adsman_catcell" valign="top"> <div class="adds_maincat" {if $categories[category]->watchListed_flag}class="cat_watchlist"{/if}> {include file='elements/display_fields.tpl' position='categoryicon' this_add=$categories[category]->id} <a href="{if $categories[category]->kids>0}{$categories[category]->link}{else}{$categories[category]->view}{/if}" > {$categories[category]->catname} </a> {if $categories[category]->is_new} <!--NEW!!--> <img src="{$IMAGE_ROOT}new.png" alt="new ads" /> {/if} <a href="{$categories[category]->view}" title="{jtext text='ADS_VIEW_LISTINGS'}"> <img src="{$IMAGE_ROOT}view_listings.gif" class="ads_noborder" alt="{jtext text='ADS_VIEW_LISTINGS'}" /> </a> {if $is_logged_in} {if $categories[category]->watchListed_flag} <img src="{$IMAGE_ROOT}watchlist.png" width="16"class="ads_noborder" /> {/if} <a href="{$categories[category]->link_watchlist}"> <img src="{$categories[category]->img_src_watchlist}" width="16" class="ads_noborder" title="{if $categories[category]->watchListed_flag}{jtext text='ADS_REMOVE_FROM_WATCHLIST'}{else}{jtext text='ADS_ADD_TO_WATCHLIST'}{/if}"/> </a> {/if} <br /> </div> <div class="adds_subcat" style="background:#F5F5F5; border:1px solid #FFFFFF; " > {include file='elements/display_fields.tpl' position='categorydetails' this_add=$categories[category]->id} <br /> {section name=subcategory loop=$categories[category]->subcategories} {include file='elements/display_fields.tpl' position='categoryicon' this_add=$categories[category]->subcategories[subcategory]->id} <a href="{if $categories[category]->subcategories[subcategory]->kids>0}{$categories[category]->subcategories[subcategory]->link}{else}{$categories[category]->subcategories[subcategory]->view}{/if}">{$categories[category]->subcategories[subcategory]->catname}</a> {if $categories[category]->subcategories[subcategory]->is_new==1} <img src="{$IMAGE_ROOT}new.png" alt="new ads" /> {/if} ({$categories[category]->subcategories[subcategory]->nr_a} {jtext text="ADS_ADS"}) {if $categories[category]->subcategories[subcategory]->watchListed_flag} <img src="{$IMAGE_ROOT}watchlist.png" width="16" class="ads_noborder" /> {/if} {if $is_logged_in} <a href="{$categories[category]->subcategories[subcategory]->link_watchlist}"> <img src="{$categories[category]->subcategories[subcategory]->img_src_watchlist}" width="14" class="ads_noborder" title="{if $categories[category]->subcategories[subcategory]->watchListed_flag}{jtext text='ADS_REMOVE_FROM_WATCHLIST'}{else}{jtext text='ADS_ADD_TO_WATCHLIST'}{/if}"/> </a> {/if} <br /> <p style="margin-left:25px;"> {include file='elements/display_fields.tpl' position='categorydetails' this_add=$categories[category]->id} </p> {/section} </div> </td> {if $smarty.section.category.rownum is not odd} </tr> {/if} {/section} </table> </div> Many thanks Hi, having stopped php for a while, i'm a little rusty, can someone help me - instead of the results returning in a row by row format, can i have it so it returns column by column? so, rather than result 1 being first, then 2 underneath then 3 etc etc, can i have result 2 next to result 1? heres my code $result = mysql_query("SELECT * FROM members ORDER BY member_id DESC") or die(mysql_error()); echo "<table border='2'>"; echo "<tr> <th></th> <th></th> <th></th> </tr>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<tr><td>"; echo $row[printf('<img src="%s" height="96" width="128" style="border: 0" />', $row['profile_pic_short'])]; echo "</td><td>"; echo "<a href=\"PHP-Login/advert_pages/view_profile_specific.php?seller_name=$row[login]\">". $row['login'] . "</a>"; echo "</td></tr>"; } echo "</table>"; ?> all help appreciated thanks i have this code but it shows the password of the user to... Code: [Select] <?php $database="dynamicg_sites"; mysql_connect ("localhost","dynamicg_sites","boom123"); @mysql_select_db($database) or die( "Unable to select database"); $result = mysql_query( "SELECT * FROM sites order by votes DESC" ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); print "<br>\n"; print "There are $num_rows News Articles"; print "<br>\n"; print "<table width=457 border=0>\n"; print "<tr>\n"; print "<td>\n"; echo "Title:"; print "</td>\n"; print "<td>\n"; echo "Description:"; print "</td>\n"; print "<td>\n"; echo "Votes:"; print "</td>\n"; print "</tr>\n"; while ($get_info = mysql_fetch_row($result)){ print "<tr>\n"; foreach ($get_info as $field) print "\t<td><font face=arial size=2/>$field</font></td>\n"; print "</tr>\n"; } print "</table>\n"; print "<br />\n"; print "<br />\n"; ?>i was wondering how do i make this only show certain columns... thanks in advance... Hi, I have a piece of code which I trying to search two columns but I just cant get it to work. Instead it just dumps around 30 entries onto the page. Can anyone point me in the direction of how to search two columns? Code: [Select] $query = "SELECT * FROM questions"; if(isset($_GET['question']) && !empty($_GET['notes'] )) { /*query the database*/ $question = $_GET['question']; $notes = $_GET['notes']; $query .= " WHERE question && notes like '%$question%' LIMIT 0, 10"; } $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { $question = $row['question']; $notes = $row['notes']; echo "$question $notes </br>"; } Hi! I have a table called "Categories" Here is the structu id | Categories | ParentCategories 1 | Rings | Parent Category 2 | Pendants | Parent Category 3 | Ladies Rings | Rings 4 | Ladies Pendants | Rings 5 | Gents Rings | Gents 6 | Necklaces | Parent Category But Necklaces is one of those who is not going to have any subcategories or you can say, it is going to be a category by itself. So how can I construct a php statement to get data out of MySQL to determine that Necklaces is a Category which does not have subcategories. Please help ! Thank you ! - Xeirus. I am fetching a data from database which comes out like this EmpID First Name DoJ Supervisor '34698' 'Ian Bobby' '2011-08-09' 'Daniel Lin' '34684' 'Sally Dodd' '2011-08-09' 'James Kirk' '34871' 'Alan Dandy' '2011-08-09' 'Pamela Roy' I want to Transpose it like this EmpID '34698' '34684' '34871' First Name 'Ian Bobby' 'Sally Dodd' 'Alan Dandy' DoJ '2011-08-09' '2011-08-09' '2011-08-09' Supervisor 'Daniel Lin' 'James Kirk' 'Pamela Roy' Please help I have this code which works fine. I want to improve it by displaying it into multiple columns. Current output: TITLE 1 JOB1 --------- TITLE 2 JOB 2 --------- ETC... I want it to display like this instead: TITLE 1 | TITLE 2 JOB 1 | JOB 2 Here is my code: $sql = "SELECT * FROM coaches WHERE position = 'Junior Coach'"; $result = mysql_query ($sql); while ($row = mysql_fetch_array($result)){ $id = $row["id"]; $firstname = $row["firstname"]; $lastname = $row["lastname"]; $position = $row["position"]; $image = $row["image"]; ?> <table width="183" border="1"> <tr> <td align="center" height="18"> <?php echo "<img id='image_shadowCoaches' src=" . $image . ">"; ?><br /> <?php echo "<div id='Coaches_Detail'>".$firstname." ".$lastname."</div>" ?> <?php echo "<div id='Coaches_DetailLower'>".$position."</div>" ?> </td> </tr> </table> <?php } ?> |