folgender fehler erscheint über einem Post im Forum sobald ein Gast dort hineinschreibt:
1064 : 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 in Query: SELECT name FROM ic1_grundrechte WHERE id = Debug backtrace: @ mysql.php:32 -- debug_bt() @ mysql.php:50 -- db_check_error(...) @ show_posts.php:65 -- db_query(...) @ forum.php:129 -- require_once(...) @ index.php:38 -- require_once(...)
Dafür verantwortlich mache ich diesen Code schnipsel in der show_posts.php
$recht_name = @db_result(db_query("SELECT name FROM prefix_grundrechte WHERE id = ".$row['recht']),0);
Und hier die komplette Datei:
<?php # Copyright by: Manuel # Support: www.ilch.de defined ('main') or die ( 'no direct access' ); # check ob ein fehler aufgetreten ist. check_forum_failure($forum_failure); # toipc als gelesen markieren $_SESSION['forumSEE'][$fid][$tid] = time(); $title = $allgAr['title'].' :: Forum :: '.$aktTopicRow['name'].' :: Beiträge zeigen'; $hmenu = $extented_forum_menu.'<a class="smalfont" href="index.php?forum">Forum</a><b> » </b>'.aktForumCats($aktForumRow['kat']).'<b> » </b><a class="smalfont" href="index.php?forum-showtopics-'.$fid.'">'.$aktForumRow['name'].'</a><b> » </b>'; $hmenu .= '<span class="smalfont">'.$aktTopicRow['name'].$extented_forum_menu_sufix.'</span>'; $design = new design ( $title , $hmenu, 1); $design->header(); # Topic Hits werden eins hochgesetzt. db_query('UPDATE `prefix_topics` SET hit = hit + 1 WHERE id = "'.$tid.'"'); # mehrere seiten fals gefordert $limit = $allgAr['Fpanz']; // Limit $page = ($menu->getA(3) == 'p' ? $menu->getE(3) : 1 ); $MPL = db_make_sites ($page , "WHERE tid = ".$tid , $limit , 'index.php?forum-showposts-'.$tid , 'posts' ); $anfang = ($page - 1) * $limit; $antworten = ''; if (($aktTopicRow['stat'] == 1 AND $forum_rights['reply'] == TRUE) OR ($_SESSION['authright'] <= '-7' OR $forum_rights['mods'] == TRUE)) { $antworten = '<a class="link_green" href="index.php?forum-newpost-'.$tid.'">Antwort erstellen</a>'; } $class = 'Cmite'; $tpl = new tpl ( 'forum/showpost' ); $ar = array ( 'SITELINK' => $MPL, 'tid' => $tid, 'ANTWORTEN' => $antworten, 'TOPICNAME' => $aktTopicRow['name'] ); $tpl->set_ar_out($ar,0); $i = $anfang +1; $ges_ar = array ('wurstegal', 'maennlich', 'weiblich'); $erg = db_query("SELECT geschlecht, prefix_posts.id,txt,time,recht,erstid,erst,sig,avatar,posts FROM `prefix_posts` LEFT JOIN prefix_user ON prefix_posts.erstid = prefix_user.id WHERE tid = ".$tid." ORDER BY time LIMIT ".$anfang.",".$limit); while($row = db_fetch_assoc($erg)) { $class = ( $class == 'Cnorm' ? 'Cmite' : 'Cnorm' ); # define some vars. $row['sig'] = ( empty($row['sig']) ? '' : ''.bbcode($row['sig']) ); $row['TID'] = $tid; $row['class'] = $class; $row['date'] = date ('d.m.Y - H:i:s', $row['time'] ); $row['delete'] = ''; $row['change'] = ''; if (!is_numeric($row['geschlecht'])) { $row['geschlecht'] = 0; } if (file_exists($row['avatar'])) { $row['avatar'] = '<img src="'.$row['avatar'].'" style="max-width:40px; max-height:40px;" alt="Avatar" border="0" />'; } elseif ($allgAr['forum_default_avatar']) { $row['avatar'] = '<img src="include/images/avatars/'.$ges_ar[$row['geschlecht']].'.jpg" style="max-width:40px; max-height:40px;" alt="Avatar" border="0" />'; } else { $row['avatar'] = ''; } $row['rang'] = userrang ($row['posts'],$row['erstid']); $row['txt'] = (isset($_GET['such']) ? markword(bbcode ($row['txt']),$_GET['such']) : bbcode ($row['txt']) ); $row['i'] = $i; $row['rechtname'] = @db_result(db_query("SELECT name FROM prefix_grundrechte WHERE id = ".$row['recht']),0); if ( $row['posts'] != 0 ) { #User Online o Offline $abf1 = "SELECT * FROM prefix_online where uid = ".$row['erstid']; $erg1 = db_query($abf1); $status = db_num_rows($erg1); if ($status >= 1) { $row['online'] = '<span style="color:#586512;">online</span>'; } else { $row['online'] = '<span style="color:#9b0000;">offline</span>'; } } else {$row['online'] = '';} $recht_name = @db_result(db_query("SELECT name FROM prefix_grundrechte WHERE id = ".$row['recht']),0); $row['page'] = $page; if ( $row['posts'] != 0 ) { $row['erst'] = '<a class="link_orange" href="index.php?user-details-'.$row['erstid'].'"><b>'.$row['erst'].'</b></a>'; } elseif ( $row['erstid'] != 0 ) { $row['rang'] = 'gelöschter User'; } if ( $row['posts'] != 0 ) { $row['usergallery'] = '<a class="link_green" href="index.php?user-usergallery-'.$row['erstid'].'">Usergalerie anzeigen</a>'; } elseif ( $row['erstid'] != 0 ) { $row['usergallery'] = ''; } if ($forum_rights['mods'] == TRUE AND $i>1) { $row['delete'] = '<a class="link_green" href="index.php?forum-delpost-'.$tid.'-'.$row['id'].'">löschen</a>'; } if ( $forum_rights['reply'] == TRUE AND loggedin() ) { $row['change'] = '<a class="link_green" href="index.php?forum-editpost-'.$tid.'-'.$row['id'].'">editieren</a>'; } $row['posts'] = ($row['posts']?''.$row['posts']:'').''; $tpl->set_ar_out($row,1); $i++; } $tpl->set_ar_out( array ( 'SITELINK' => $MPL, 'ANTWORTEN' => $antworten ) , 2 ); if (loggedin()) { if ($menu->get(3) == 'topicalert') { if (1 == db_result(db_query("SELECT COUNT(*) FROM prefix_topic_alerts WHERE uid = ".$_SESSION['authid']." AND tid = ".$tid),0)) { db_query("DELETE FROM prefix_topic_alerts WHERE uid = ".$_SESSION['authid']." AND tid = ".$tid); } else { db_query("INSERT INTO prefix_topic_alerts (tid,uid) VALUES (".$tid.", ".$_SESSION['authid'].")"); } } echo '<div style="padding:0 0 0 50px;"><br/>'; if (1 == db_result(db_query("SELECT COUNT(*) FROM prefix_topic_alerts WHERE uid = ".$_SESSION['authid']." AND tid = ".$tid),0)) { echo '<br /><a class="link_grey" href="index.php?forum-showposts-'.$tid.'-topicalert">'.$lang['nomailonreply'].'</a><br />'; } else { echo '<br /><a class="link_grey" href="index.php?forum-showposts-'.$tid.'-topicalert">'.$lang['mailonreply'].'</a><br />'; echo '</div>'; } } if ( $forum_rights['mods'] == TRUE ) { $tpl->set ( 'status', ($aktTopicRow['stat'] == 1 ? $lang['close'] : $lang['open'] ) ); $tpl->set ( 'festnorm', ($aktTopicRow['art'] == 0 ? $lang['fixedtopic'] : $lang['normaltopic'] ) ); $tpl->set('tid',$tid); $tpl->out(3); } $design->footer(); ?>
Ich währe euch sehr sehr dankbar wenn ihr mir helfen könntet
betroffene Homepage: externer Link