Kommentar script
HejsaJeg er ved at lave Kommentar system til nyhed system :)
indtil videre er jeg kommet så langt at den henter en bestemt nyhed
men det går galt når jeg vil Vise Kommentarene :(
Her er koden:
<?
include "mysql.php";
$query = mysql_query ("SELECT * FROM news WHERE id = '$_GET[id]'") or die(mysql_error());
while ($newsrow = mysql_fetch_array($query)){
echo "
<table>
<tr>
<td>
<b>".$newsrow['emne']." - Dato: ".$newsrow['dato']."</b><br />
";
$text = htmlspecialchars($newsrow['nyhed']);
$text = str_replace(":D", "<img src=\"smilie/icon_biggrin.gif\">", $text);
$text = str_replace(":S", "<img src=\"smilie/icon_confused.gif\">", $text);
$text = str_replace(":8", "<img src=\"smilie/icon_cool.gif\">", $text);
$text = str_replace(":cr", "<img src=\"smilie/icon_cry.gif\">", $text);
$text = str_replace(":¨", "<img src=\"smilie/icon_eek.gif\">", $text);
$text = str_replace(":e", "<img src=\"smilie/icon_evil.gif\">", $text);
$text = str_replace("!", "<img src=\"smilie/icon_exclaim.gif\">", $text);
$text = str_replace(":i", "<img src=\"smilie/icon_idea.gif\">", $text);
$text = str_replace(":l", "<img src=\"smilie/icon_lol.gif\">", $text);
$text = str_replace(":[", "<img src=\"smilie/icon_mad.gif\">", $text);
$text = str_replace(":|", "<img src=\"smilie/icon_neutral.gif\">", $text);
$text = str_replace("?", "<img src=\"smilie/icon_question.gif\">", $text);
$text = str_replace(":r", "<img src=\"smilie/icon_razz.gif\">", $text);
$text = str_replace(":f", "<img src=\"smilie/icon_redface.gif\">", $text);
$text = str_replace(":re", "<img src=\"smilie/icon_rolleyes.gif\">", $text);
$text = str_replace(":(", "<img src=\"smilie/icon_sad.gif\">", $text);
$text = str_replace(":)", "<img src=\"smilie/icon_smile.gif\">", $text);
$text = str_replace(":O", "<img src=\"smilie/icon_surprised.gif\">", $text);
$text = str_replace(":tw", "<img src=\"smilie/icon_twisted.gif\">", $text);
$text = str_replace(";)", "<img src=\"smilie/icon_wink.gif\">", $text);
$text = nl2br($text);
echo $text;
?>
<br>
<br>
<?
echo "
<td>
</tr>
</table>
<br>
<hr />
";
}
?>
Her til går det fint..
I mens går der noget galt her jeg kan ikke helt fint hvad det er jeg gører forkert :(
<br>
<br>
<?
include "mysql.php";
$query = mysql_query "SELECT navn, email, www, kommentar FROM comment WHERE nyhedsid='$_GET[id]' ORDER BY id DESC") or die(mysql_error());
while ($rs = mysql_fetch_array($query)){
?>
<hr size="1" color="#000000" width="350">
<br />
<font size="1"><? echo $rs['dato'] ?></font>
Navn: <? echo $rs['navn'] ?>
<br>
<? echo "Netfang: <A HREF=\"mailto:$rs[email]\">$rs[email]</A>"; ?>
<br>
<? echo "WWW: <a href=\"$rs[www]\" target=\"_Blank\">$rs[www]</a>"; ?>
<br>
Skoðun: <? echo $rs['kommentar'] ?>
<br>
<form action="post.php" method="post">
<table width="246" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="56" scope="col">Navn</th>
<th width="190" scope="col"><input type="text" name="navn"></th>
</tr>
<tr>
<th scope="row">Netfang</th>
<td><input type="text" name="email"></td>
</tr>
<tr>
<th scope="row">WWW</th>
<td><input type="text" name="www"></td>
</tr>
<tr>
<th scope="row">Skoðun</th>
<td><textarea name="kommentar"></textarea></td>
</tr>
</table>
</form>
</body>
</html>
Håber nogen kan hjælpe mig
På forhånd tak
M.V.H. Th1
