473,396 Members | 1,929 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.

sorting into collumns



I have data in a mysql databse. eg

ardvark
bee
clever
diva
elephant
fight
girl
heart
ink
joke
kill

I can retrive in alphabetical order without problem.

What i want to do is display in three rows with them sorted
downwards.. so bee is under ardvark and not in the next collumn

for HTML purposes I devided the total results by three and placed into
three tables which I then displayed side by side.. This also works for
printing...

However i want to also save the results to file and thus the format
has to be in ASCII using data and \t and \n etc but I cant get into
the same three collumns like that :(

Any help appreciated :)

Jul 17 '05 #1
2 1663
Sam
On Wed, 03 Dec 2003 14:07:58 +0000, mail wrote:


I have data in a mysql databse. eg

ardvark
bee
clever
diva
elephant
fight
girl
heart
ink
joke
kill

I can retrive in alphabetical order without problem.

What i want to do is display in three rows with them sorted
downwards.. so bee is under ardvark and not in the next collumn

for HTML purposes I devided the total results by three and placed into
three tables which I then displayed side by side.. This also works for
printing...

However i want to also save the results to file and thus the format
has to be in ASCII using data and \t and \n etc but I cant get into
the same three collumns like that :(

Any help appreciated :)


something like:

$limit = sizeof($myarray);
for($i = 0; $i < ($limit / 3); $i++)
{
echo "$myarray[$i]\t
$myarray[$i + $limit]\t
$myarray[$i + ($limit * 2)]\n"
}

ought to do it, I think, modulo ($limit / 3) giving a sensible result.
Maybe it should be ($limit / 3) + 1. Whatever, this seems a sensible place
from which to start.

Sam
;)

Jul 17 '05 #2
On Wed, 03 Dec 2003 14:37:36 +0000, Sam
<sa*@SPAMSPAMSPAM.rexfeatures.com> wrote:
Any help appreciated :)
something like:


Yup:)

$limit = sizeof($myarray);
for($i = 0; $i < ($limit / 3); $i++)
{
echo "$myarray[$i]\t
$myarray[$i + $limit]\t
$myarray[$i + ($limit * 2)]\n"
}

ought to do it, I think, modulo ($limit / 3) giving a sensible result.
Maybe it should be ($limit / 3) + 1. Whatever, this seems a sensible place
from which to start.

correct.. $limit/3 worked a treat... plus of course taking arrays out
of string :)

Many thanks for your help much appreciated and now...sorted:)
--
KIPAX (www.kipax.com)
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dont bother | last post by:
This is really driving me crazy. I have a dictionary feature_vectors{}. I try to sort its keys using #apply sorting on feature_vectors sorted_feature_vector=feature_vectors.keys()...
1
by: monomaniac21 | last post by:
Hi all Does anyone know of an efficient way to retreive data from a mysql db and display the record rows as collumns? I have been doing this: <display headers> <while ($row =...
4
by: robbiegrady | last post by:
I am trying to find matches between two collumns in different tables. Table A has a collumn called "description" which is a text field containing all or part of an customers name along with alot of...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.