I am trying to create a bit of php code that will display LOTGD news elsewhere on my site. I have done some code, but unfortunately the output is a bit scrambled due to the way news is stored in the database.
<?php
$username="user";
$password="password";
$database="database";
@mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT * FROM lotgd_news ORDER BY newsid DESC LIMIT 0,3";
$result = @mysql_query($query)
or die ("Couldn't execute query: " . mysql_error());
echo "<b>Latest Legend of the Green Dragon News</b><br /><br />";
while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
{
extract($row);
echo "$newstext<br /><br />";
}
?>
Output:
Latest Legend of the Green Dragon News
`%%s`5 has been slain in the forest by %s.`n%s
`%%s`5 has challenged their master, %s and lost!`n%s
`%%s`3 has defeated her master, `%%s`3 to advance to level `^%s`3 after `^%s`3 days!!
Can anyone tell me what changes I need to make to get the code to work properly. I know there is another column in the news table that contains the relevant information, but I do not know how to incorporate it.