18.12.2013, 18:49
PHP код:
<?php
$con = mysql_connect("localhost","username","password");
if(!$con) die("Error connecting to database!");
$con = mysql_select_db("database");
if(!$con) die("Error selecting database!");
$string = "SELECT * FROM `News` ORDER BY `ID` DESC";
$result = mysql_query($string);
if(!$result)
{
echo "Error reading news from MYSQL!";
exit;
}
echo '<center><table width="80%"><tr><td>';
while($news = mysql_fetch_array($result,MYSQL_ASSOC))
{
echo '<center><br><br><br><span style="color:white"><strong><font size="5">'.$news['Title'].'</font></strong><br><br>'.$news['Text'].'</span></center><span style="color:white"><br><p align="right"><i>by '.$news['Admin'].' at '.$news['Time'].'</i></p></span><br>';
}
echo "</td></tr></table></center>";