DarkSummer
Erfahrenes Mitglied
hi ich hab ein prob mit einem news script das prob liegt gleich bei der ersten while schleife und der fehler ist
ein result fehler
hier die news.php
ein result fehler
hier die news.php
PHP:
<?php
switch($to)
{
case "":
$abfrage = "SELECT * FROM pnews order by id desc";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_array($ergebnis)) // da sagt er wär der fehler
{
$x = mysql_result(mysql_query("SELECT COUNT(id) FROM pcomments WHERE nid = '".$row->id."'"), 0);
$row->thema = smilie($row->thema);
$row->news = smilie($row->news);
echo "
<table border=0 cellspacing=0 cellpadding=0>
<tr>\n
<td width='391' height='17' colspan=3 background='gfx/headline.jpg'>$row->thema</td>\n
</tr>\n
<tr>
<td bgcolor='#FFFFFFF' width=300 height=100 valign=top></td>\n
<td width=1 height=100 background=gfx/pixel.gif valign=top></td>
<td bgcolor='#FFFFFFF' width=90 valign=top><a href=index.php?site=news/news.php&to=comments&id=$row->id>Comments[$x]</a></td>
</tr>
</table>";
}
break;
case comments:
if(isset($id))
{
$abfrage = "SELECT * FROM pnews WHERE id LIKE '$id'";
$ergebnis = mysql_query($abfrage);
$row = mysql_fetch_object($ergebnis);
$x = mysql_result(mysql_query("SELECT COUNT(id) FROM pcomments WHERE nid = '".$row->id."'"), 0);
echo "<table border=0 cellspacing=0 cellpadding=0>
<tr>\n
<td width='391' height='17' colspan=3 background='gfx/headline.jpg'>$row->thema</td>\n
</tr>\n
<tr>
<td bgcolor='#FFFFFFF' width=300 height=100 valign=top></td>\n
<td width=1 height=100 background=gfx/pixel.gif valign=top></td>
<td bgcolor='#FFFFFFF' width=90 valign=top><a href=index.php?site=news/news.php&to=comments&id=$row->id>Comments[$x]</a></td>
</tr>
</table>";
if($x == "0")
{
echo "keine comments vorhanden zur zeit";
} else {
$abfrage1 = "SELECT * FROM pcomments WHERE nid LIKE '$id'";
$ergebnis1 = mysql_query($abfrage);
while($raw = mysql_fetch_object($ergebnis))
{
echo "$raw->name postete <br>\n
<hr width=50% color='#FFFFFF'><br>\n
$raw->comment";
}
}
}
else { $id = 0;}
echo "<form action=home.php?news.php&to=comments&id=$id><table border=0>
<tr>
<td >Name</td><td>:</td><td><input type=text name=cname value='$user' style=' width: 200'></td>
</tr>
<tr>
<td>Mail</td><td>:</td><td><input type=text name=mail style='width: 200'></td>
</tr>
<tr>
<td><br><br></td><td></td><td><br><br><textarea rows=7 style=' width: 350'>Ihr Comment</textarea></td>
</tr>
<tr>
<td></td><td></td><td><input type=submit name=submit style=' width: 100'></td>
</tr>
</table></form>";
break;
}
?>