Hi All,
I need some advice for a SQL Query.
I have 2 tables, one contains information used to create a page that links to a details page created with data from the second table.
Table 1 is called 'Locos' and contains the following fields
LocoID, CurrentNo, Photo, Title, Caption, Copy, update
There are 72 records in this table, eg of data is
2866, 37003, 37003, North Yorkshire, 37003 at Bedale, John Doe, 2004-10-03 00:00:00
2888, 37025, 37025, Scotland, 37025 at Bo'ness Yard, John Doe, 2007-11-02 00:00:00
Using dreamweaver and extensions I have created a looper to create the table on the front page with displays the CurrentNo with a link to the details page using the LocoID as a reference.
Table 2 is called 'details' and contains the following fields
id, LocoID, pub, Type, date, details, notes, update
This table is continuously increasing in records but some of the data like that included in the table is listed below.
1, 2866, y, OW, 1998-08-30, NULL, Bought by the XXXXX, 2010-01-31 00:00:00
2, 2866, y, LI, 2000-02-10, NULL, Repainted in Green Livery, 2010-02-01 17:04:34
3, 2888, y, OW, 2003-03-21, NULL, Bought by the XXXXX, 2009-09-21 03:30:33
4, 2866, y, NA, 2005-08-30, NULL, Named XXXX at Chappel, 2008-12-31 22:08:40
I have created a loop on the details page that displays the data from table 2 using the reference from the first page.
Now you can hopefully see what I have done?
Now to create the last date on the details page, the following query called rsDetails is used
SELECT 'update' FROM details WHERE pub ='y' AND LocoID = colname ORDER by 'update' DESC and to publish the date on the site I use this PHP
<?php echo ($rows_rsDetails['update']); ?>
Now what I want to do is add an image besides the number that appears on the front page if a row of content connected to the LocoID reference is updated or added to table 2.
I know how to add the image if table 1 is updated, so I think I need to run the rsDetails query to get the results I need, then add the result into the update field of table one?
Can this be done? Or do I need to do this some other way? Any advice or pointers would be much appreciated.
Many Thanks
Phil