You'll need to post some example code and preferably any table definitions to get a really accurate answer, but in essence from what you have posted I would assume something like this would work
Main Topics
Browse All TopicsI have some training course data set up in a database. Each class belongs to a category - for example:
CATEGORY NAME
Blue Training Class Name #1
Red Training Class Name #2
Green Training Class Name #3
Yellow Training Class Name #4
Red Training Class Name #5
Red Training Class Name #6
I am reading the data into my page using a while loop. The expected results is that there are four sections on the page and that the classes will appear under each section as such:
BLUE
--------------------
Training Class #1
RED
--------------------
Training Class #2
Training Class #5
Training Class #6
GREEN
--------------------
Training Class #3
YELLOW
--------------------
Training Class #4
Problem is, my page is only showing the first section (BLUE) and it's class listing, then the next three headers are showing up with nothing listed under them. What I think is happening is that the loop is only going through the data once and then stopping. Help! This page is really problematic and I have to get it resolved. The page problem is actually live and can be found here: http://www.dc-ei.com/Train
I am VERY new to PHP, so any suggestions would be really appreciated.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
bportlock, that is similar to the code I had before and it would only run through the loop once.
TDS, I reworked my code to your example and it yielded the following error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/dcei00/public_html/T
My code is attached.
Business Accounts
Answer for Membership
by: TDSPosted on 2009-05-06 at 08:42:37ID: 24316157
Please post your loop code here and the database structure.
For Example you nee two tables, one for the color codes and one for the classes.
CREATE TABLE `test1`.`test1` (
`id` INT NOT NULL AUTO_INCREMENT ,
`cat` VARCHAR( 10 ) NOT NULL ,
`name` VARCHAR( 100 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM;
CREATE TABLE `test1`.`test2` (
`id` INT NOT NULL AUTO_INCREMENT ,
`cat` INT NOT NULL ,
`name` VARCHAR( 100 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM;
The second table, field "cat", points to the first table, field "id".