supanoob Posted March 27, 2008 Share Posted March 27, 2008 OK, so i want to be able to group multiple rows using the "Date" field and have them in a drop down menu which i will then use along with the user ID field to bring all actions performed on that date by that person, is this possible? if so how? Link to comment https://forums.phpfreaks.com/topic/98221-grouping-rows/ Share on other sites More sharing options...
Barand Posted March 27, 2008 Share Posted March 27, 2008 try <?php $res = mysql_query ("SELECT DISTINCT `date` FROM tablename ORDER BY `date` "); echo "<select name='date'>\n"; while ($row = mysql_fetch_row($res)) { $t = strtotime($row[0]); printf ("<option value='%s'>%s</option>\n", date('Y-m-d', $t), date('d M y', $t)); } echo "</select>\n"; ?> Link to comment https://forums.phpfreaks.com/topic/98221-grouping-rows/#findComment-502589 Share on other sites More sharing options...
supanoob Posted March 27, 2008 Author Share Posted March 27, 2008 try <?php $res = mysql_query ("SELECT DISTINCT `date` FROM tablename ORDER BY `date` "); echo "<select name='date'>\n"; while ($row = mysql_fetch_row($res)) { $t = strtotime($row[0]); printf ("<option value='%s'>%s</option>\n", date('Y-m-d', $t), date('d M y', $t)); } echo "</select>\n"; ?> Great thanks Link to comment https://forums.phpfreaks.com/topic/98221-grouping-rows/#findComment-502598 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.