influenceuk Posted May 24, 2007 Share Posted May 24, 2007 Can any one tell me if there is a way to display data from a MySQL DB in groups? For example: May: Item 1 1/05/2007 Item 2 2/05/2007 Item 3 3/05/2007 June: Item 4 1/06/2007 Item 5 2/06/2007 Item 6 3/06/2007 And so on... Obviously i would be after having a title of that current month etc. But would need the data to go and update on its own, so once may has gone, June would be he first month, if you see what i mean? Any help would be great cheers Quote Link to comment https://forums.phpfreaks.com/topic/52743-format-sql-to-display-data-in-a-group/ Share on other sites More sharing options...
hitman6003 Posted May 24, 2007 Share Posted May 24, 2007 Haven't tested it, but... SELECT item_name, date, STR_TO_DATE(date_column, '%d/%m/%Y') AS dtg FROM table_name WHERE MONTH(dtg) >= MONTH(NOW()) ORDER BY dtg ASC Quote Link to comment https://forums.phpfreaks.com/topic/52743-format-sql-to-display-data-in-a-group/#findComment-260431 Share on other sites More sharing options...
Barand Posted May 24, 2007 Share Posted May 24, 2007 see http://www.phpfreaks.com/forums/index.php/topic,141406.msg602568.html#msg602568 Quote Link to comment https://forums.phpfreaks.com/topic/52743-format-sql-to-display-data-in-a-group/#findComment-260533 Share on other sites More sharing options...
influenceuk Posted May 24, 2007 Author Share Posted May 24, 2007 Cheers guys! I feel like a bit of a tit now lol that post you guided me to is almost the same as what i posted!! Quote Link to comment https://forums.phpfreaks.com/topic/52743-format-sql-to-display-data-in-a-group/#findComment-260545 Share on other sites More sharing options...
influenceuk Posted May 24, 2007 Author Share Posted May 24, 2007 Barand, I tried it however i could not get it to work Basically i have this table set up... Title Studio Release Now i wanna get try get them displayed in months as stated above. I saw what you had given the other guy worked for him, i could just not work out how to mod the code for my use? Quote Link to comment https://forums.phpfreaks.com/topic/52743-format-sql-to-display-data-in-a-group/#findComment-260575 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.