• 0

Remove date from events list..


Question

I have a vbulletin forum where members can add events which are then displayed on a separate page as a list.

I have created a little script to extract the events from the database which works really well.

however, if there are a bunch of event on the same day it prints the date on every event. I would like to display the date on only the first event for that day.

for example, at the moment it's doing this.

Fri 30th Apr - Event 1

Fri 30th Apr - Event 2

Fri 30th Apr - Event 3

Sat 31st Apr - Event 1

Sat 31st Apr - Event 2

Sat 31st Apr - Event 3

I would like it to do this:

Fri 30th Apr - Event 1

...................Event 2

...................Event 3

Sat 31st Apr - Event 1

....................Event 2

....................Event 3

Is it possible using the code below?

The way i've thought about it is..

if date_line is different to previous dateline then *code here without echo dateline* else *code here with date line*

i just don't know how to translate the bit in bold.

 	
<?php mysql_select_db("XXXXXXXX");

$time_now = time();
$day_before = $time_now - 86400;

$result = mysql_query ("SELECT dateline, dateline_from, eventid, title FROM event WHERE calendarid = 3 AND dateline_from >= '$day_before' ORDER BY dateline_from LIMIT 10");

while($row = mysql_fetch_array($result)) {
echo "<p style='padding:2px'>". date("l - d M Y", $row['dateline_from']+54000)." - <a href='/forum/calendar.php?do=getinfo&e=" . $row['eventid'] . "&c=3#events'><b>". $row['title'] . "</b></a></p>" ;
}
?>
[/PHP]

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.