Grave-Digger
Banned
- Registriert
- Juni 2005
- Beiträge
- 253
Hiho!
Wenn ich versuche einen Kommentar der $cid mit der passenden Newsid $id einfüge klappt das nich :-( Könnnt ihr mir helfen?
Wenn ich versuche einen Kommentar der $cid mit der passenden Newsid $id einfüge klappt das nich :-( Könnnt ihr mir helfen?
PHP:
<?php
// comments.php
include('config.php');
echo "<link href='style.css' rel='stylesheet' type='text/css'>";
if(is_numeric($_GET['id'])){
$result = mysql_query("SELECT cid, comment, autor from comments WHERE id = $id") or die(mysql_error());
$anzahl = mysql_num_rows($result);
while($row = mysql_fetch_array($result)){
$id = $row['id'];
$cid = $row['cid'];
$comment = $row['comment'];
$autor = $row['autor'];
$ausgabe1.="
<table width='100%' border='0' cellpadding='0' cellspacing='0' class='comment'>
<!--DWLayoutTable-->
<tr>
<td width='1085' height='25' valign='top' background='img/comment_header.jpg' class='Stil1'><strong><em>$cid) </em>$autor']</strong> ($date, $time) </td>
<td width='160' valign='top' background='img/comment_header.jpg'><span class='Stil1'> Editieren | Antworten </span></td>
</tr>
<tr>
<td height='25' colspan='2' valign='top' bgcolor='#F4F4F4'>$comment</td>
</tr>
</table>
";
}
echo $ausgabe1;
}
?>
<br>
<form method="POST" action="news.php">
<div align="center">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="205" height="25" valign="top">Name:</td>
<td width="1040" valign="top"><input name="name" type="text" size="131"> </td>
</tr>
<tr>
<td height="342" valign="top">Kommentar Text: </td>
<td valign="top"><textarea name="comment" cols="130" rows="20"></textarea> </td>
</tr>
<tr>
<td height="25" valign="top">Newsid:</td>
<td valign="top"><input name="id" type="text"></td>
</tr>
</table>
<input type="submit" name="submit" value="submit">
</div>
</form>
<?php
foreach($_POST as $key=>$element){
${"c_".$key} = $element;
}
if(isset($_POST['submit'])){
mysql_query("INSERT INTO `comments` (`comment`, `autor`, `id`) VALUES ('c_id', '$c_comment', '$c_name')");
}
?>
// news_show.php ( daher kommt auch die $id ) :D
<?php
require('config.php');
require('smilies.php');
echo "<link href='style.css' rel='stylesheet' type='text/css'>";
$title = "News Anzeigen von ID: $id";
echo "<title>$title</title>";
if(is_numeric($_GET['id'])){
$result = mysql_query("SELECT id,titel,text,newsimg,autor from news WHERE id = $id")
or die("<div align='center'>Error</div>");
$anzahl = mysql_num_rows($result);
while($row = mysql_fetch_array($result)){
$id = $row['id'];
$titel = $row['titel'];
$text = $row['text'];
$autor = $row['autor'];
$ausgabe = "
<table width='100%' border='0' cellpadding='0' cellspacing='0'>
<!--DWLayoutTable-->
<tr>
<td height='25' colspan='3' valign='top'>$titel</td>
</tr>
<tr>
<td height='25' colspan='3' valign='top'>$text</td>
</tr>
<tr>
<td width='942' height='25'> </td>
<td width='49' valign='top'>Autor:</td>
<td width='254' valign='top'>$autor</td>
</tr>
</table>
";
echo $ausgabe;
}
echo "
<table width='100%' border='0' cellpadding='0' cellspacing='0' class='comment1'>
<!--DWLayoutTable-->
<tr>
<td width='1245' height='23' valign='top' background='img/comment.jpg'><strong>Kommentare</strong></td>
</tr>
</table><br>
";
include('comments.php');
echo "<div align='center'><a href='news.php'>Zurück</a></div><br>";
}
?>