http://pastebin.com/KMPyQHK9
Código PHP:
01.php /////////////////////////////////////////////////////////////////
<?php
class DBS
{
public static $link;
public static function connect($host,$user,$password,$database)
{
DBS::$link = mysqli_connect($host, $user, $password, $database);
}
public static function query($query)
{
return mysqli_query(DBS::$link, $query);
}
public static function assoc($result)
{
return mysqli_fetch_assoc($result);
}
}
?>
02.php /////////////////////////////////////////////////////////////////
<?php
include('01.php');
DBS::connect('127.0.0.1', 'root', '********', 'mydb');
?>
03.php /////////////////////////////////////////////////////////////////
<?php
require_once('02.php');
$query = DBS::query('SELECT * FROM coments ORDER BY ID DESC LIMIT 25');
while($row = DBS::assoc($query))
{
echo $row['user'];
echo $row['coment'];
}
?>