Hej!
Jeg har et nyheds system, det duer fint, bortset fra at når man kommenterer en nyhed, så kommer den her fejl:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /web/www/frac/users/bam/news/news.display1.php on line 19
og den her:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /web/www/frac/users/bam/news/news.display1.php on line 27
her er news.display1.php:
<? ob_start(); ?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<?php
include('../forumlogin/logon/include/session.php');
include_once('inc.config.php');
mysql_connect($cfg['mysql']['host'],$cfg['mysql']['username'],$cfg['mysql']['password']);
mysql_select_db($cfg['mysql']['database']);
$query = mysql_query("SELECT *,DATE_FORMAT(date,'%e/%c-%y %T') AS date FROM news WHERE id=".$_GET['id']."");
$row = mysql_fetch_assoc($query);
echo '<h1>'.$row['title'].'</h1>';
echo '<p>[b]'.$row['synopsis'].'[/b]</p>';
echo '<p>'.$row['author'].' - '.$row['date'].'</p>';
echo nl2br($row['text']);
echo '<div class="hr"></div>';
$query = mysql_query("SELECT *,DATE_FORMAT(date,'%e/%c-%y %T') AS date FROM comments WHERE parent=".$_GET['id']." ORDER BY id ASC");
if (mysql_num_rows($query) > 0) {
echo '<h2>Kommentarer</h2>';
while ($row = mysql_fetch_assoc($query)) {
echo empty($row['email']) ? htmlspecialchars($row['name']) : '<a href="mailto:'.$row['email'].'">'.htmlspecialchars($row['name']).'</a>';
echo ' ('.$row['date'].')';
echo nl2br(htmlspecialchars($row['text']));
echo '<div class="hr"></div>';
}
}
?>
<h2>Comment news</h2>
<?
session_start ();
if($session->logged_in){
// hvis man er logget ind
include("komm.php");
}
else {
echo "You have to be logged in to make a comment, log in or <a link href=\\"../forumlogin/logon/register.php\\">register a new user</a>";
}
?>
<a href="index.php">News</a> | <a href="news.search.php">search news</a>
</body>
</html>
<? ob_flush; ?>
Håber der err en der kan fortælle mig hvorfor den skriver disse fejl...