Thanks
So far I am 50% of the way there, and I'm using this code:
PHP Code:
<?php
require('./admin/config.php');
//connect
$connection = mysql_connect("$servername","$dbusername","$dbpassword") or die ("Cannot connect to server.");
//select database
$db = mysql_select_db("$dbname", $connection) or die ("Could not select database.");
// create sql statement
$sql = "SELECT postid FROM post LEFT JOIN thread ON thread.threadid=post.threadid WHERE thread.forumid IN (22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38) AND thread.dateline=post.dateline ORDER BY post.dateline DESC LIMIT 4";
//execute sql query
$sql_result = mysql_query($sql, $connection) or die ("Could not execute query.");
while ($row = mysql_fetch_array($sql_result)) {
$postid = $row["postid"];
}
echo "
<img src=\"http://www.pcreview.co.uk/attachment.php?postid=$postid\" border=\"0\">
";
mysql_free_result($sql_result);
mysql_close($connection);
?>
What I really need is to get the $threadid of that post, the $postid (which works!), and the $title. This code currently displays the 4th last image to be attached in those forums, can you help me modify it so all the last 4 are, and so I can call $threadid and $title too?