sql syntax error
Når jeg gennem køre dette her script:<?php
include ('db.php');
$query = mysql_query("SELECT id,header,name,DATE_FORMAT(date,'%e/%c-%y %T') AS date FROM auktion WHERE parent=0 ORDER BY id DESC LIMIT $offset,$range") or die(mysql_error());
if (mysql_num_rows($query) == 0) {
echo 'Der er ingen vare på auktionen!<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_auktion.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 auktion WHERE parent=$row[id]"),0).'</td>';
echo '</tr>';
}
echo '</table>';
}
echo '<br>';
$antal = mysql_result(mysql_query("SELECT COUNT(*) FROM auktion 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 ';
}
?>
får jeg denne her 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 1
