Log in

View Full Version : Combine rows together



lindsaycb
03-17-2009, 07:16 PM
I have a MySQL table. The fields in the table include the following:
playerName, rostSport, college, years, Reb, RPG...

For each year that the student was at school, I have put in the database their stats for Rebounds & Rebounds Per Game and so on. So some students are listed 4 times, for each year they played.

I have a table that has their name dynamically created by another bit of PHP code. Their names are only listed once. http://www.kishwaukeecollege.edu/athletics/basketball-mens/past_kougars.shtml (click on T. J. Collins)

I would like to be able to combine all rows that include their name together in one table. Right now it's only showing the row that matches their ID from the link. http://www.kishwaukeecollege.edu/athletics/past_player.shtml?id=5

Is there a way to combine all rows when the name matches into one HTML table??

lindsaycb
03-17-2009, 07:45 PM
No a bit of joke, but this rocks http://****************/h23.html

so there's no way of doing it at all????? I thought there would be...

JasonDFR
03-17-2009, 08:10 PM
There is a way to do what you want. I'll try to help you out tomorrow. I think the guy who posted that link is spamming the board and was not responding to your question.

lindsaycb
03-18-2009, 02:17 PM
There is a way to do what you want. I'll try to help you out tomorrow. I think the guy who posted that link is spamming the board and was not responding to your question.

Thank you! I look forward to reading your reply!

lindsaycb
03-20-2009, 02:13 PM
There is a way to do what you want. I'll try to help you out tomorrow. I think the guy who posted that link is spamming the board and was not responding to your question.

Is there a way you could help me with this problem?

CrazyChop
03-20-2009, 05:04 PM
Maybe can you post the SQL statements that you are using?

To combine columns from different tables which share the same foreign keys, you need to do a join



$sql = "select * from table1, table2 where table1.id = table2.id";