sorry guys not been around for a while - work has got in the way!
Right Kops. You only come 'round when it's time for a
booty codie call

(j/k mate ... nice to have you around)
code to open the db connection - Ok get that bit
code to query the url string to identify the id number - i.e.
www.discountcodesite.com/blahblah/display_data.php?id=XXThen a number of calls at different parts of the page to get the following pieces of information relevant to that id number:
Page Title
ALT Keywords
ALT Description
Retailer name
discount code
date
Assuming that all the above information is in a single table (so that we don't have to discuss JOINs in this post) it's fairly straightforward and you've already pretty much gotten there.
First, open the database. Looks like you're there. Now the ID of the item you want will be in the $_GET array - that is a global array provided by PHP which gives you access to everything in the querystring. It is an associative array - so using
$theID = $_GET['id']
would set $theID to 'XX' (based on your example above). Now you'll want to throw a SQL query to grab the data record that has your data. your function will look something like this:
$handle = mysql_query("select * from itemtable where id='{$_GET['id']}'");
$row = mysql_fetch_assoc($handle);
...assuming, again, that you've done some cleaning of the URL as described above to make sure that JasonD or NOP doesn't have his way with you.
(Please note that I don't use the mysql_ functions anymore, I use my own class for database connections, so I am not 100% certain of my syntax - but the essence is correct)
Now, you could do a simple page output like this:
echo <<<HTML
Thank for visiting The Really Spammy Site.<br>
The item you're looking for is {$row['id']} described as {$row['caption']} and the price is {$row['price']}
HTML;
In this example I'm using a HEREDOC form ( <<< ) to output a big 'ol chunk of HTML, and references to the "row" array, that was populated when I did mysql_fetch_assoc.
Hope that makes more sense... good luck mate!
/p