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 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'];
}
?>
Screen del resultado en la consola.
[URL="http://pasteboard.co/1qXnKx31.png"]http://pasteboard.co/1qXnKx31.png[/URL]