<?
mysql_connect($db_host, $db_user, $db_pass);
mysql_select_db($db_name);
$sql = "SELECT * FROM news_site LEFT JOIN staff ON news_site.poster = staff.id WHERE news_site.show = '1' ORDER BY news_site.posted desc LIMIT 10";
$results = mysql_query($sql);
$rowcount = mysql_num_rows($results);
$i = "0";
while ($data = mysql_fetch_array($results)) {
$i++;
print "<u>$data[title]</u><br>";
print "$data[post]<br><br>";
print DateConvert($data['posted'], "l, jS F Y @ H:i:s");
if ($i != $rowcount) {
print "<hr noshade size=1 color=#3366cc>";
}
}
?>
Right so thats all good, however i need to fetch the posters display name from the "staff" table. I am new to using table joins so this is probably quite simple for those of you who have been doing it for a while.
Thanks in advance,
Dave
Last edited by Christian; 04-09-06 at 05:13 PM.
Reason: PLEASE USE [PHP][/PHP] WHEN POSTING PHP CODE!