Prova ad inserire un controllo di errore ogni volta che utilizzi l'oggetto $mysql:
Codice PHP:$limit = 5; // articoli per pagina
$mysql = new mysqli('localhost', 'root', 'password');
if(!$mysql)
{
die("Errore di connessione al database, impossibile procedere");
}
$mysql->select_db('nome_del_tuo_database');
if($mysql->error)
die("Errore MySQL: ".$mysql->error);
$result = $mysql->query("SELECT COUNT(*) AS tot FROM articles")->fetch_assoc();
if($mysql->error)
die("Errore MySQL: ".$mysql->error);
$page = isset($_GET['p']) ? $_GET['p'] : 1;
$totals = $result['tot'];
$totals_pages = ceil($totals / $limit);
$articles = $mysql->query("
SELECT
AR.id AS id,
AR.title AS title,
CONCAT(SUBSTR(AR.article, 1, 200), ' ...') AS content,
CONCAT(AU.surname, ' ', AU.name) AS author
FROM
articles AR,
authors AU
WHERE
AR.author_id = AU.id
ORDER BY id DESC
LIMIT ".(($page - 1) * $limit).",".$limit);
if($mysql->error)
die("Errore MySQL: ".$mysql->error);
?>

Rispondi quotando