Jump to content

Grouping Rows


supanoob

Recommended Posts

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

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 :D

Link to comment
https://forums.phpfreaks.com/topic/98221-grouping-rows/#findComment-502598
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.