Calling Forum Data from the DB

Calling Forum Data from the DB

by Simon James -
Number of replies: 0

I want to print the the latest 3 News Forum headlines from my Moodle homepage to a page outside Moodle. I have another very simple news database the headlines and dates from which I print out very easily like this:

<?php require_once("Connections/databse.php"); ?>
<?
$query = "SELECT * FROM loquela_news ORDER BY news_date DESC LIMIT 3";

$result = mysql_query($query);

mysql_close();
?>

*********************************


<?php echo ("<table>");
while($rows=mysql_fetch_row($result))
{
echo("<tr><td align='left' nowrap='nowrap'><a href='pages/news_item.php?news_id=$rows[0]'>$rows[1]</a></td><td align='right'>$rows[4]</td></tr>");
echo("<tr><td colspan='2'>$rows[2]</td></tr>");
}
echo "</table>";
?> 

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

I would like the headlines and the dates from my Moodle main News Forum to be printed in a similar way to the data in the Latest News block.

Now, I'm not hot with databases and I am all confused by the Moodle Forum, Post and Discussion tables,  I can identify the forum I want to get the data from that's as far as I can fathom. I would be extremely grateful if somebody could guide me in the right direction.

Simon

Average of ratings: -