spyer Posted December 3, 2006 Share Posted December 3, 2006 Good day,how are you doing? great i hope :)will, this is the problem i'm facing:[color=red]TABLE CONTENTS:[/color][color=red]-------------------------------------------------[/color] | yid | year | mid | month |[color=red]-------------------------------------------------[/color] | 1 | 2006 | 1 | November |[color=red]-------------------------------------------------[/color] | 1 | 2006 | 2 | December |[color=red]-------------------------------------------------[/color] | 2 | 2007 | 3 | January |[color=red]-------------------------------------------------[/color][color=red]TABLE STRUCTURE:[/color][color=red]---------------------------------------------------------------------------[/color] | yid | int(12) | UNSIGNED | |[color=red]---------------------------------------------------------------------------[/color] | year | varchar(100) | | |[color=red]---------------------------------------------------------------------------[/color] | mid | int(12) | UNSIGNED | auto_increment |[color=red]---------------------------------------------------------------------------[/color] | month | varchar(100) | | |[color=red]---------------------------------------------------------------------------[/color][color=red]USED CODE:[/color][code]<?php$yl = mysql_query("SELECT * FROM list");while ($blah = mysql_fetch_array($yl)) {echo "$blah[year]<br>";}?>[/code][color=red]PRINTED RESULTS:[/color]200620062007---- END ----above you'll see the printed results where the year [color=blue](2006)[/color] is dublicated.. and this is because the year id [color=blue](yid)[/color] has the same value [color=blue](1)[/color].I need the get the results and print them without dublicating any value.Thank you very much, and sorry for the long speech :-[ Link to comment https://forums.phpfreaks.com/topic/29302-help-in-fetching-results-from-database/ Share on other sites More sharing options...
chiprivers Posted December 3, 2006 Share Posted December 3, 2006 SELECT * FROM list GROUP BY year Link to comment https://forums.phpfreaks.com/topic/29302-help-in-fetching-results-from-database/#findComment-134291 Share on other sites More sharing options...
spyer Posted December 3, 2006 Author Share Posted December 3, 2006 i feel so silly :-[it was so simple :Dthank you very very very much.. you were so helpful Link to comment https://forums.phpfreaks.com/topic/29302-help-in-fetching-results-from-database/#findComment-134315 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.