pc-world: Warning: mysql_fetch_array(): supplied argument is not a ...

Beitrag lesen

Hallo, ich bekomme bei meiner Seite folgende Fehlermeldung:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ...

Ich habe schon im Internet nach diesem Problem gesucht und auch schon ein bisschen rumprobiert, was allerdings bis jetzt noch nichts genützt hat.

Hier mein Code:

  
<?php  
include "mysqlconfig.inc.php"; //MySQL-Login sowie DB-Auswahl  
  
//Variablen-Sicherheit  
$res =  mysql_query("select max(id) AS max from ".$tableforen);  
$row =  mysql_fetch_array($res);  
$maxForumId = $row["max"];  
if(isset($_GET['fid']) && $_GET['fid'] > 0 &&  $_GET['fid'] < ($maxForumId + 1) ) { $fid = mysql_real_escape_string(htmlentities($_GET['fid'],ENT_QUOTES)); } else { echo 'Keine Forums-ID empfangen oder die Forums-ID existiert nicht.'; exit; }  
  
$res =  mysql_query("select max(id) AS max from ".$tablethreads);  
$row =  mysql_fetch_array($res);  
$maxThreadId = $row["max"];  
if(isset($_GET['tid']) && $_GET['tid'] > 0 &&  $_GET['tid'] < ($maxThreadId + 1) ) { $tid = mysql_real_escape_string(htmlentities($_GET['tid'],ENT_QUOTES)); } else { echo 'Keine Thread-ID empfangen oder die Thread-ID existiert nicht.'; exit; }  
  
//Lesen aus DB  
$topic = mysql_query("SELECT * FROM '".$tablethreads."' WHERE id='".$tid."'");  
$topic = mysql_fetch_array($topic);  
$topic = $topic['topic'];  
echo '<h1>'.$topic.'</h1><br><br>';  
  
$res = mysql_query("select * from ".$tableanswers." where fid=".$fid." AND tid=".$tid);  
  
//ausgeben  
while($row = mysql_fetch_array($res)) {  
 $text = nl2br($row["text"]);  
 echo '<fieldset>  
        <legend>'.$row["user"].'schrieb:</legend>'.  
        $text.'</p>';  
}  
?>