Skip to main content
August 23, 2006
Question

Database with events

  • August 23, 2006
  • 2 replies
  • 312 views
I've got a database with records of events. I save every event with a date and now I would like have a list of alle events structured in day-order. Sometimes there are to event and sometimes there ten event per day.

How do I get a block for each day like this:

http://www.husetmagstraede.dk/default.asp?id=1

I'm not the great code neard - so please tell me slowly how to do :-)

/Rudy
This topic has been closed for replies.

2 replies

Participating Frequently
August 23, 2006
I am sorry, I cannot.
Participating Frequently
August 23, 2006
One way would be to build a couple of queries and build the page dynamically with php.
Like this

<?php

$host = 'localhost';
$user = 'user';
$pass = 'password''

$link = mysql_connect($host, $user, $pass);

$dateQry = "SELECT date from table_EventTable ORDER BY date";
$dateList = mysql_query($dateQry, $link) or die (mysql_error());
// do not close the link to the database yet...
?>
....... SOME HTML .........

<?php

// run through the list of dates
while ($rowDate = mysql_fetch_assoc ($dateList)) {
$currDate = $rowDate['date'];
echo $currDate . "\n";
$eventQry = "SELECT event, time, location FROM table_EventTable WHERE date = ' . $currDate;
$eventList = mysql_query($eventQry , $link) or die (mysql_error());
while ($rowEvent = mysql_fetch_assoc ($dateList)) {
$currEvent = $rowEvent['event'];
$currTime = $rowEvent['time'];
$currLoc = $rowEvent['location '];
echo 'At ' . $currTime . ' ' . $currEvent . ' is happening here: ' . $currLoc . "\n";
}
}

mysql_free_result($eventList);
mysql_free_result($dateList );



You can apply tables and or other formatting in the code, but this will give a basic idea of ONE possible solution.

I hope this works for you!!
August 23, 2006
Sorry, I forgot to tell that my site is an ASP site.

Can you do it in ASP?

/Rudy