Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
wystan
Forum Newbie
Posts: 5 Joined: Thu Jun 03, 2004 11:49 am
Post
by wystan » Fri Jun 04, 2004 9:32 am
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
Joe
Forum Regular
Posts: 939 Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow
Post
by Joe » Fri Jun 04, 2004 9:34 am
use LIMIT 3. So a query would look like:
SELECT * FROM table LIMIT 3
Wayne
Forum Contributor
Posts: 339 Joined: Wed Jun 05, 2002 10:59 am
Post
by Wayne » Fri Jun 04, 2004 9:47 am
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.
Joe
Forum Regular
Posts: 939 Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow
Post
by Joe » Fri Jun 04, 2004 10:06 am
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 » Fri Jun 04, 2004 10:27 am
i got it to work with 2 while loops
Joe
Forum Regular
Posts: 939 Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow
Post
by Joe » Fri Jun 04, 2004 10:52 am
Congradulations pal. Happy coding!