473,396 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

displaying single column data in multiple columns

26
This might seem like a problem with a simple solution, but I'm not entirely sure how to approach it.

I would like to generate a user contact list from a table of user details on a database. However, for the master page (which only needs to display the name), I was wondering if there is any way that the user names could be displayed in multiple rows rather than one continuous vertical stream (I would rather avoid recordset paging).

I suppose you could do it horizontally by outputting each record in a css block element one third of the total div width, but I would rather do it in a vertical direction ie you go down, then start at the top and once again for a 3 column list.

Any pointers in the right direction would be appreciated.
Aug 6 '07 #1
4 2167
kovik
1,044 Expert 1GB
?

Maybe... a table...?
Aug 7 '07 #2
erp23
26
sorry, maybe I wasn't clear enough -

yes, I could use a table, but what I'm not sure is how to do the looping structure in order to go down vertically ie

Item 1 - Item 4 - Item 7
Item 2 - Item 5 - Item 8
Item 3 - Item 6 - Item 9

Presumably you need some sort of auto-increment counter to decide where to draw <tr> and <td>? Or create two divs and assign recordsets to $col1 $col2 and $col3?

My main problem is that the total number of contacts can vary, so the number per column will be the total no. of contacts / 3...

Is this possible or should I just try and go for a horizontal order
Item1 - Item 2 - Item3 etc
?
Aug 7 '07 #3
kovik
1,044 Expert 1GB
[php]echo '<table><tr>';
$i = 0;

while($data = mysql_fetch_object($result))
{
$i++;

if(($i % 3) == 0)
{
$i = 0;
echo '</tr><tr>';
}

echo '<td>' . $data->foo . '</td>';
}

echo '</tr></table>';[/php]

Maybe?
Aug 7 '07 #4
erp23
26
yes, that's along the lines of what I'm looking for - wasn't quite sure about the exact syntax with counter divisions, but adapting this has worked. thanks.
Aug 9 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: JB | last post by:
To anyone that is able to help.... What I am trying to do is this. I have two tables (Orders, and OrderDetails), and my question is on the order details. I would like to set up a stored...
3
by: Jane | last post by:
Hi, If anyone could help me with this, I greatly appreciate it. I would like to know how I can display data from a db in multiple columns rather than have it displayed in 1 column per recordset....
5
by: Lisa Calla | last post by:
Hi, I need to display records with lots of fields. When placed in a grid, a row of data will scroll off the screen. Not exactly what I'm looking for. I've also used a datalist, which allows...
7
by: What-a-Tool | last post by:
Have an Access table loaded into a DataTable that was created at run time, and am displaying these contents in a data grid. Me.dgGames.DataSource = Me.DsGameInfo.Tables("Games") I would like to...
3
by: CLEAR-RCIC | last post by:
I have several images i want to display in an ASP.Net application. The images are being passed to me in binary format from another application. Is there a good way to write them directly to an...
5
by: BMeyer | last post by:
I have been losing my mind trying to parse an XML document (with nested child elements, not all of which appear in each parent node) into a DataGrid object. What I want to do is "flatten" the XML...
3
by: CD | last post by:
An application is logging faxes sent in SQL2000 image column type. I have found code on the net but what it is doing is prompting to save to local which is fine for single page image. Not good...
3
by: connected | last post by:
I'm having difficulty with populating a DataGridView control with data correctly. It works with a single class, for example... class MyClass { private string _propertyOne; private string...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.