Hab hier folgendes Problem ich erzeuge hier News artikel und will diese anzeigen jedoch passiert wenn die id = 0 ist folgendes -> Es werden alle Newseinträge angezeigt ! Warum ?
Hier ist der Code:
Danke im voraus!
Hier ist der Code:
PHP-Code:
<?
if($action == "readnews" && $id == $i){
$writer = mysql_result($Result3,$i,"writer");
$email = mysql_result($Result3,$i,"email");
$date = mysql_result($Result3,$i,"date");
$newstitel = mysql_result($Result3,$i,"newstitel");
$shortnews = mysql_result($Result3,$i,"shortnews");
$extendednews = mysql_result($Result3,$i,"extendednews");
$id = mysql_result($Result3,$i,"id");
?>
<table width="557" border="0" align="center" cellpadding="0" cellspacing="4">
<tr>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><? echo("<b>$newstitel</b>"); ?>
geschrieben am <? echo($date); ?> von <? echo("<a href=mailto:$email>$writer</a>"); ?></font></td>
</tr>
<tr>
<td>
<?
echo("$shortnews<br>$extendednews");
?>
</td>
</tr>
<tr>
<td> <form name="form3" method="post" action="index.php?action=writecomment&id=<? echo($i); ?>">
<br>
<table width="422" border="0" align="center" cellpadding="0" cellspacing="3">
<tr>
<td colspan="2"><font size="2"><strong>Kommentar schreiben:</strong></font></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="87"><font size="2">Name:</font></td>
<td width="335"><input name="name" type="text" id="name"></td>
</tr>
<tr>
<td><font size="2">E-Mail:</font></td>
<td><input name="email" type="text" id="email"></td>
</tr>
<tr>
<td valign="top"><font size="2">Kommentar:</font></td>
<td><textarea name="comment" cols="25" rows="8" id="comment" maxlength="200"></textarea></td>
</tr>
<tr>
<td colspan="2"><input type="hidden" name="newsid" value="<? echo($id); ?>"></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="reset" name="Submit22" value="Zurücksetzen">
<input type="submit" name="Submit32" value="Kommentar schreiben">
</div></td>
</tr>
</table>
</form>
<?
$Result4 = mysql_query("SELECT * FROM lan_newscomment WHERE newsid = '$id'");
for($i = 0; $i < mysql_num_rows($Result4); $i++){
$name = mysql_result($Result4,$i,"name");
$email = mysql_result($Result4,$i,"email");
$name = mysql_result($Result4,$i,"name");
$comment = mysql_result($Result4,$i,"comment");
?>
<div align="center"></div>
<div align="center"></div>
<div align="center"></div>
<table width="422" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bordercolor="#000000"> <table width="422" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><? echo("<b><a href=mailto:$email>$name</a></b>"); ?></td>
</tr>
<tr>
<td height="19"><? echo($comment); ?></td>
</tr>
</table></td>
</tr>
</table>
<div align="center"><br>
<br>
<?
}
?>
<a href="index.php" target="_self"><< Zurück zu den
News</a> <br>
<br>
</div></td>
</tr>
</table>
<?
}
}
?>
Kommentar