Im trying to create a nice little piece of code that will pull threads from my forums no matter where I put the page. (I dont want clientside javascript). Currently, this code isn't working, can someone give it a quick look and see where it might be wrong?
Code:
<?php
$db_host = "localhost";
$db_name = "databasename";
$db_user = "username";
$db_pw = "dbpassword";
$forum_url = "http://www.mysite.com";
$limit = "5";
$postedcolor = "#404040";
$fontface = "arial,verdana,geneva";
$txtlimit = "50";
$num = "0";
mysql_connect($db_host, $db_user, $db_pw)
OR die ("Cannot connect to your database");
mysql_select_db($db_name) OR die("Cannot connect to your database");
$tsql = mysql_query("SELECT threadid,title,postusername FROM thread ORDER BY threadid DESC LIMIT $limit");
while($tget=mysql_fetch_array($tsql))
{
$num = $num+1;
$title = $tget['title'];
$tid = $tget['threadid'];
$poster = $tget['postusername'];
echo "<strong>$num.</strong> <a href=\"$forum_url/showthread.php?t=$tid\">$title</a><br /><font color=\"$postedcolor\" face=\"$fontface\" size='1'><i>posted by $poster</i></font><br /><br />";
}
?>