[SOVLED] echo results

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
wystan
Forum Newbie
Posts: 5
Joined: Thu Jun 03, 2004 11:49 am

[SOVLED] echo results

Post by wystan »

I'm trying to echo results in a table, showing 3 results per line

something looking like

select id from table

1 | 2 | 3
4 | 5 | 6
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

use LIMIT 3. So a query would look like:

SELECT * FROM table LIMIT 3
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post by Wayne »

use LIMIT 3. So a query would look like:

SELECT * FROM table LIMIT 3
... is not a good idea, that would mean you would have to run a seperate query for every row of the table.
you are going to need to use some php coding to get this done, so maybe if one of the moderators would be kind enough to move this to the correct section!

to start you in the right direction though try looking at WHILE loops for example, Im sure if you search the site you will find an example thats already been posted.
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

My apologies I never realised that the user in question was asking for several 3row results. I only thought 1 row. Anyway good luck pal!
wystan
Forum Newbie
Posts: 5
Joined: Thu Jun 03, 2004 11:49 am

Post by wystan »

i got it to work with 2 while loops
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Congradulations pal. Happy coding!
Post Reply