breaking up records.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Phper's
I am returning some dates from a rescordset. At Present it displays
something like this.


10May
09Apr
09Apr
08Apr
08Apr
08Apr
08Apr



I have broken up the string so I can display the Motnth (May) and the Day
(10) as I please. I am hoping to be able to display the records like this
below.
But am having trouble achieving a while or a do while.



May
10

Apr
09, 08, 08, 08, 08


I have something like this and of course it is wrong...;0)

// code for displaying the month and the days in that month horizontally
across

while ($slctArchiverow = mysql_fetch_array...  //fetching the array

// obtaining the month and day from the string
$getMonth = substr($slctArchiverow[diaryMonth],3); //month
$getDay = substr($slctArchiverow[diaryMonth],0,2); //day


echo $getMonth; //displays the month (May)
do			//display the days that are within May
{
echo $getDay;	//display the string which is the day of the month
echo ", ";
} while ($getMonth == $getMonth); //while the month is equal to May
echo "<br>";
}

}

Is it possible to do it in this way or do I need to use if statements for
each month of the year??
eg.
if ($getMonth = May) // and so on for all 12 months.

What are your thoughts??


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux