Ho il seguente errore ho controllato e ricontrollato ma nn riesco a capire il motivo di questo errore:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /web/htdocs/www.fifaclubs.com/home/test/paginazione/all.php on line 29
Codice PHP:
<?
include("config.inc.php");
$db = mysql_connect($db_host, $db_user, $db_password);
if ($db == FALSE)
die ("Errore nella connessione. Verificare i parametri nel file config.inc.php");
mysql_select_db($db_name, $db)
or die ("Errore nella selezione del database. Verificare i parametri nel file config.inc.php");
if (!isset($start) OR $start<0)
$start=0;
$step = 20;
$query = "SELECT ID,nick,documento FROM $db_table, ORDER BY ID DESC LIMIT $start,$step";
$result = mysql_query($query, $db);
(questa e la 29 riga) while ($row = mysql_fetch_array($result))
{ echo "<a href=\"view.php?id=$row[id]\">" . date("j/n/y", $row[data]) . " - $row[nick]</a>
"; }
?>
<table width=90% border=0><tr>
<td width=20% align=left>
<?
if ($start>0)
{ $start_back = $start - $step;
echo "<a href=all.php?start=$start_back>precedenti</a>";
}
?>
</td>
<?
$query = "SELECT count(*) AS tot FROM $db_table";
$result = mysql_query($query, $db);
$row = mysql_fetch_array($result);
$pages = intval(($row[tot]-1) / $step)+1;
?>
<td width=60% align=center>
<?
for ($i=0; $i<$pages AND $i<20; $i++)
{ $start_page = $i * $step;
echo "<a href=all.php?start=$start_page>" . ($i+1) . "</a> ";
}
?>
</td>
<td width=20%>
<?
if ($start + $step < $row[tot])
{ $start_next = $start + $step;
echo "<a href=all.php?start=$start_next>successivi</a>";
}
?>
</td>
</tr></table>
<?
echo "<a href=search.php>Cerca negli articoli</a>";
?>