Ich möchte die 5 neuesten Post aus meinem Forum auf meiner Webseite wiedergeben und habe ein Script gefunden, welches für PHPBB-Forum gedacht war. Ich habe dieses für mein IPB-Forum umgeschrieben. Und bekomme Fehlermeldungen, wenn ich es ausführe.
Hier erstmal das Script:
	
Und die Fehlermeldung sieht wie folgt aus:
	
							
						
					Hier erstmal das Script:
PHP-Code:
	
	
<?PHP
// MySQL Connection Information
  $host = '';   // Datenbank Server
  $database = '';      // Datenbank deines Forums
  $username = '';      // Datenbank Benutzername
  $password = '';      // Datenbank Passwort
  $postcount = '5';      // Anzahl der letzten Nachrichten
  
####################################################
mysql_connect("$host","$username","$password") OR die(mysql_error());
mysql_select_db("$database") OR die(mysql_error());
    $sql = "SELECT pid, author_id, topic_id FROM ibf_posts ORDER BY post_date DESC LIMIT " . $postcount;
    $result = mysql_query($sql) or die(mysql_error().'<hr />'.'$sql'.'<hr />');
    while ($row = mysql_fetch_assoc($result))
    {
    $postid = $row->pid;
    $userid = $row->author_id;
    $topicid = $row->tid;
    $sql = "SELECT title FROM ibf_topics WHERE tid = '" . $topicid . "'";
    $r = mysql_query($sql) or die(mysql_error().'<hr />'.'$sql'.'<hr />');
    $threadtitle = mysql_result($r,'title');                                # Zeile 24
    
    $sql = "SELECT post_title FROM ibf_posts WHERE pid = '" . $postid . "'";
    $r = mysql_query($sql) or die(mysql_error().'<hr />'.'$sql'.'<hr />');
    $title = mysql_result($r,'post_title');                                    # Zeile 28
    $sql = "SELECT post FROM ibf_posts WHERE pid = '" . $postid . "'";
    $r = mysql_query($sql) or die(mysql_error().'<hr />'.'$sql'.'<hr />');
    $text = mysql_result($r,'post');                                        # Zeile 32
    $text = substr($text, 0, 50) . "...";    // nur die ersten 50 Zeichen
    $sql = "SELECT name FROM ibf_members WHERE id='" . $userid . "'";
    $r = mysql_query($sql) or die(mysql_error().'<hr />'.'$sql'.'<hr />');
    $nick = mysql_result($r,'post_title');                                    # Zeile 37
    echo "Thread Titel: $threadtitle<br>
          Post Titel: $title<br>
          Benutzername: $nick<br>
          Text: $text<br><br>";
    }
?>
Code:
	
	Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 3 in /hp/ag/ab/of/www/Webseite/sites/news.php on line 24 Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 4 in /hp/ag/ab/of/www/Webseite/sites/news.php on line 28 Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 5 in /hp/ag/ab/of/www/Webseite/sites/news.php on line 32 Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 6 in /hp/ag/ab/of/www/Webseite/sites/news.php on line 37 Thread Titel: Post Titel: Benutzername: Text: ...
 
          
 Moderator
 Moderator
Kommentar