SELECT e.name
,d.cod_team
,d.cod_challenge
,d.title
,d.details
,d.score
,de.proof
,de.date_concluded
,de.cod_challenge_team
FROM teams e
INNER JOIN challengeperteam de ON de.cod_teamFk = e.cod_team
INNER JOIN challenges d ON d.cod_challenge = de.cod_challengeFk
WHERE de.status = 0
ORDER BY e.cod_team DESC, de.cod_challenge_team DESC;
I get something like:
Team A
blabla 1
Team A
blabla 4
Team A
blabla3
Team B
blabla9
Team B
blabla8
But I would like to have, instead:
Team A
blabla1
blabla4
blabla2
Thanks a lot. So, at the end of the interaction you fill $lastName with the present value, and, by doing so, you make sure that That name, will appear only once. Yes?
With this, you don’t need strange (or I’m just ignorant) things like unset.
Do you think that a DO WHILE will be of some use on this scenario?
Nope, all you need is the idea of the code I provided. Which does assume the data is sorted by $row[‘name’] btw! If it isn’t the code won’t work (think about it).
I don’t follow. Could you explain that a little differently?
Yes… If I got you right, it’s true! Because if we do not order it by name, then the last variable will have another value at the end of the interaction but, IF later on, that value appears again, we will have it twice when, only once was requested.
(I’m to tired to properly express myself - hope this makes sense. O.o).
hhm…
foreach($rows as $row) {
do {
echo $row['lastname'];
} while ($row['lastname'] .... );
arrgghh - bed time already.
nvm.
Tomorrow, I will try to implement this according to my needs and see what I get. You absolutely rock with your dialectic method, cheers to that.