ciao ragazzi, io ho un problema del genere, ecco il codi che ho fatto:
Codice PHP:
<?php
$limit = 5; // articoli per pagina
$mysql = new mysqli('localhost', 'root', '', 'vacanze');
if(!$mysql)
{
die("Errore di connessione al database, impossibile procedere");
}
$result = $mysql->query("SELECT COUNT(*) AS tot FROM immobili")->fetch_assoc();
$page = isset($_GET['p']) ? $_GET['p'] : 1;
$totals = $result['tot'];
$totals_pages = ceil($totals / $limit);
$articles = $mysql->query("SELECT * FROM immobili WHERE tipologia='affitto' ORDER BY ID LIMIT ".(($page - 1) * $limit).",".$limit);
?>
<html>
<head>
<title>Immobili</title>
</head>
<body>
<ul>[*][url="index.php"]Lista articoli[/url][*][url="insert.php"]Inserisci un articolo[/url][/list]
Immobili totali: <?php echo $totals; ?></p>
<?php while($result=mysql_fetch_array($articles)){
$cat=$result[4];
$logo=mysql_query("SELECT logo FROM categorie WHERE tipologia='$cat' ");
$result1=mysql_fetch_array($logo);
?>
<table align="center">
<tr>
<td rowspan="4" width="133"><div align="center">[img]<?php echo $result[13];?>[/img]" alt="<?php echo $result[3];?>" width="150" height="100"></div></td>
<td rowspan="2"></td>
<td width="400" rowspan="2" id="sottotitolo"><?php echo $result[3]; ?></td>
<td></td>
</tr>
<tr>
<td>[img]<?php echo $result1[0]; ?>[/img]</td>
</tr>
<tr>
<td rowspan="2"></td>
<td width="400" height="80" rowspan="2" valign="top">
<?php
$testo = $result[11];
$lung_max = 15;
$finale = " ....";
$intro = intro($testo, $lung_max, $finale);
echo $intro;
?>
</td>
<td></td>
</tr>
<tr>
<td id="sottotitolo">[url="index.php?page=1&visualizza=<?php echo $result[0]; ?>"][img]images/lente.gif[/img][/url]</td>
</tr>
<tr>
<td colspan="4">[img]images/linea_div.jpg[/img]</td>
</tr>
<?php } ?>
</table>
Pagina <?php echo $page; ?> di <?php echo $totals_pages; ?>
<?php
if($page - 1 > 0)
{
echo '[url="?p='.($page - 1).'"]< prev[/url] | ';
}else
{
echo '< prev | ';
}
if($page + 1 <= $totals_pages)
{
echo '[url="?p='.($page + 1).'"]next >[/url]';
}else
{
echo 'next >';
}
?>
</p>
</body>
</html>
solo che a questo rigo:
Codice PHP:
<?php while($result=mysql_fetch_array($articles)){
mi da il seguente aiuto:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Sapete comefare perfavore