tomasd Posted September 29, 2008 Share Posted September 29, 2008 Hi all, I have table tuples which contain date and decimal values. i.e. 2008-09-01 25 2008-09-07 14 2008-09-10 17 Is there any way of doing select so it outputs following; 2008-09-01 25 2008-09-02 25 2008-09-03 25 2008-09-04 25 2008-09-05 25 2008-09-06 25 2008-09-07 14 2008-09-08 14 2008-09-09 14 2008-09-10 17 thanks for your help!!! Link to comment https://forums.phpfreaks.com/topic/126324-help-needed-with-mysql-syntax/ Share on other sites More sharing options...
Cosizzle Posted September 29, 2008 Share Posted September 29, 2008 SELECT * FROM tableName WHERE date < '2008-09-01' is that what you're looking for? Link to comment https://forums.phpfreaks.com/topic/126324-help-needed-with-mysql-syntax/#findComment-653220 Share on other sites More sharing options...
fenway Posted September 29, 2008 Share Posted September 29, 2008 Tuples in the DB? Link to comment https://forums.phpfreaks.com/topic/126324-help-needed-with-mysql-syntax/#findComment-653352 Share on other sites More sharing options...
Barand Posted September 29, 2008 Share Posted September 29, 2008 try <?php $sql = "SELECT tupledate, num FROM tuple ORDER BY tupledate"; $res = mysql_query($sql); $prevd=$prevn=''; while (list($d, $n)=mysql_fetch_row($res)) { if ($prevd != $d) { if ($prevd != '') { $date = $prevd; while ($date < $d) { echo "$date $prevn<br/>"; $date = date('Y-m-d', strtotime ("$date +1 days")); } } $prevd = $d; $prevn = $n; } } echo "$prevd $prevn<br/>"; ?> Link to comment https://forums.phpfreaks.com/topic/126324-help-needed-with-mysql-syntax/#findComment-653485 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.