Nella Guida PHP/MySql pratica mi da un errori nelle queste funzione all.php e index.php
Errore e lo stesso nelle due funzioni:
Il messagio di errore e questo:
Parse error: syntax error, unexpected '}', expecting ',' or ';' on line 20
Il codice e questo
Codice PHP:
<?
include("top_foot.inc.php");
include("config.inc.php");
top();
$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,data,titolo FROM news ORDER BY data DESC LIMIT $start,$step";
$result = mysql_query($query, $db);
while ($row = mysql_fetch_array($result))
{ echo "[url="view.php?id=$row[id]"]" . date("j/n/y", $row[data]) . " - $row[titolo][/url]
;" }
<?
<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 news";
$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>";
foot();
?>
Spero di essermi spiegato bene.