Re: [PHP] some data output formatting and grouping question...
you got the results, now loop it, and if you find Y is different from the previous one, print it: $previous=''; while($row=mysql_fetch_array($res) { if($row['Y']!=$previous) echo $row[Y]br; echo $row[X]br; } Victor wrote: I just have a fucking mental block; I cannot at all conceive the necessary syntax to or even the theoretical algorithm that I need, to do the following: Consider the following table: U | X | Y --|---|-- me|001|0a me|002|0a me|003|0a me|002|0b me|003|0b me|004|0b ..|...|.. then the code says: SELECT * FROM Y WHERE U = me So now what? - remember I do not know the value of Y, so it has to be an automatic thing; I can't just say ... WHERE U = me AND Y = a. I want this output: 0a 001 002 003 ___ (hr) 0b 002 003 004 How the hell do I do that? I can't think of the goddamn' syntax! __ Post your free ad now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] some data output formatting and grouping question...
I just have a mental block; I cannot at all conceive the necessary syntax to or even the theoretical algorithm that I need, to do the following: Consider the following table: U | X | Y --|---|-- me|001|0a me|002|0a me|003|0a me|002|0b me|003|0b me|004|0b ..|...|.. then the code says: SELECT * FROM Y WHERE U = me So now what? - remember I do not know the value of Y, so it has to be an automatic thing; I can't just say ... WHERE U = me AND Y = a. I want this output: 0a 001 002 003 ___ (hr) 0b 002 003 004 How the h3ll do I do that? I can't think of the g0dd4mn' syntax! __ Post your ad for free now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] some data output formatting and grouping question...
I just have a fucking mental block; I cannot at all conceive the necessary syntax to or even the theoretical algorithm that I need, to do the following: Consider the following table: U | X | Y --|---|-- me|001|0a me|002|0a me|003|0a me|002|0b me|003|0b me|004|0b ..|...|.. then the code says: SELECT * FROM Y WHERE U = me So now what? - remember I do not know the value of Y, so it has to be an automatic thing; I can't just say ... WHERE U = me AND Y = a. I want this output: 0a 001 002 003 ___ (hr) 0b 002 003 004 How the hell do I do that? I can't think of the goddamn' syntax! __ Post your free ad now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php