Creating a "Recent Updates" List

I have a site with a Recent Updates list on the front page. Every time I add something to the site, I add an entry to the list with the day's date and what's changed. It's actually a real bind to update because I have to download the file from the server (in case any other team members have changed it) make the changes in Dreamweaver, and then upload it again.

What would be really cool, thought I, was if I could have the text in a database, and get the page to pull say, the most recent three from the database and display them on the page. What's more, I could update this database via a web form - eliminating the need to use Dreamweaver at all - I could do it online in just a few seconds...

Come on, you want one now don't you?! Shall we build one? I think we should!

The Database

We first need to set up our database. I'm going to make mine in Access. I only need one table with two fields.

  1. Date - this could be the primary key, and could be inserted automatically.
  2. Item - what I want to say on the page. This would be a 'memo' field so that I can have more than 255 characters.

In order to get the Date field to insert today's date automatically, I set the default value to Date(). I'm going to call my table dwfNews.

If you've not already done so, set up a DSN and UltraDev connection for this database.

You may like to take the opportunity to enter 3 or 4 dummy entries into your database. This will help you test your page. You can always delete them later on.

Back in UltraDev, open up your site's home page (make sure you have a backup first!). You need to create a table where you would like your Recent Updates list to go.

Next we need to set up a Data Binding. This is where we tell UltraDev which data to use. Open the Data Binding Inspector (Window -> Data Bindings).

We want to define a database query (trust me) so we'll click the big PLUS button and select Recordset (Query).

You should then get a window looking a whole lot like this... (I can tell you're finding this exciting)

I've called my Recordset "rsRecentUpdates" - note I've put the "rs" to remind me it's a recordset which is not essential but I personally find it helpful.

I then selected the connection I made earlier from the list. The Table list should then fill up, and you can select the table with your Recent Updates data in it - if you remember, mine was called dwfNews.

The last thing I've done is chosen to sort on the Date field. I chose Descending so that the most recent dates will be at the top of the list.

Now the really cool part - click Test.

And there's the dummy entries I put in the database! It works! Milkybars are on me! (that's an English thing).
Click OK and OK to confirm the Test and Recordset windows.

You'll see some cool looking things appear in the Data Bindings window

Next >>