Mærkelig syntax fejl.
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1Jeg får denne fejl på min webserver, som køre mysql 4.0.
Min bærbar har jeg sat om som server (bruger den lokalt) med phpmyadmin osv (apache).
På min bærbar virker mit script, men når det kommer online går det galt.
<?php
include('menu.php');
include('connect.php');
$query = mysql_query("SELECT id,header,name,DATE_FORMAT(date,'%e/%c-%y %T') AS date FROM forum WHERE parent=0 ORDER BY id DESC LIMIT $offset,$range") or die(mysql_error());
if (mysql_num_rows($query) == 0) {
echo 'Der er ingen tråde i forummet!<br>';
} else {
echo '<table width="100%" id="list"><tr>';
echo '<th width="40%">Overskrift</th><th width="30%">Forfatter</th><th width="30%">Dato</th><th>Indlæg</th>';
echo '</tr>';
while($row = mysql_fetch_assoc($query)) {
echo '<tr>';
echo "<td width='40%'><a href='laes.php?id=$row[id]'>$row[header]</a></td>";
echo '<td width="30%">'.$row['name'].'</td>';
echo '<td width="30%">'.$row['date'].'</td>';
echo '<td>'.mysql_result(mysql_query("SELECT COUNT(*) FROM forum WHERE parent=$row[id]"),0).'</td>';
echo '</tr>';
}
echo '</table>';
}
echo '<br>';
$antal = mysql_result(mysql_query("SELECT COUNT(*) FROM forum WHERE parent=0"),0);
if ($offset >= $range) {
$forrige = $offset-$range;
echo "<a href='?offset=$forrige'>Forrige</a> | ";
} else {
echo 'Forrige | ';
}
if ($antal > $offset+$range) {
$naeste = $offset+$range;
echo "<a href='?offset=$naeste'>Næste</a> ";
} else {
echo 'Næste ';
}
?>
</body>
</html>
