Kod
<?
mysql_connect ("localhost", "maziq", "ppp") or
die ("Nie można połączyć się z MYSQL");
mysql_select_db ("maziq") or
die ("Nie można połączyć się z bazą cwphp4");
$miesiac = date("m");
if($limit=='' || !isset($limit)) {
$limit=10;
}
$result_news = mysql_query("select * from news order by id desc limit $limit WHERE news_id='$user'");
if(mysql_num_rows($result_news) != 0 ) {
while($row_news = mysql_fetch_row($result_news)) {
print("<TABLE VALIGN=BOTTOM CELLSPACING=0 CELLPADDING=0 BORDER=0 STYLE=\"margin-left: 2mm\"><TR><TD VALIGN=MIDDLE HEIGHT=13> <IMG SRC=img/kwadrat-news.jpg WIDTH=10 HEIGHT=10 BORDER=0 ALIGN=MIDDLE STYLE=margin-top: 2px>");
print("<font class=link><b> $row_news[1]</FONT>");
print("</TD></TR><tr><TD ALIGN=LEFT HEIGHT=1><IMG SRC=images/layout/1.jpg WIDTH=200 HEIGHT=1 BORDER=0 ALIGN=LEFT></TD></TR><TR VALIGN=TOP><TD ALIGN=LEFT HEIGHT=1> ");
print("<font class=news-data>$row_news[2].$row_news[3].$row_news[4] $row_news[5]</FONT><br>");
print("</TD></TR><tr STYLE=\"padding-top: 5px\"><TD VALIGN=TOP ><font class=link2>$row_news[6]<br></font></TD></TR> ");
$result_komentarze = mysql_query("select * from komentarze where news_id = '$row_news[0]';");
$ile = mysql_num_rows($result_komentarze);
print("<tr><TD ALIGN=RIGHT VALIGN=TOP><a class=text href=?dzial=komentarze&id=$row_news[0]>Zobacz komentarze ($ile)<br></A></TD></TR></TABLE><br>");
}
}
?>
mysql_connect ("localhost", "maziq", "ppp") or
die ("Nie można połączyć się z MYSQL");
mysql_select_db ("maziq") or
die ("Nie można połączyć się z bazą cwphp4");
$miesiac = date("m");
if($limit=='' || !isset($limit)) {
$limit=10;
}
$result_news = mysql_query("select * from news order by id desc limit $limit WHERE news_id='$user'");
if(mysql_num_rows($result_news) != 0 ) {
while($row_news = mysql_fetch_row($result_news)) {
print("<TABLE VALIGN=BOTTOM CELLSPACING=0 CELLPADDING=0 BORDER=0 STYLE=\"margin-left: 2mm\"><TR><TD VALIGN=MIDDLE HEIGHT=13> <IMG SRC=img/kwadrat-news.jpg WIDTH=10 HEIGHT=10 BORDER=0 ALIGN=MIDDLE STYLE=margin-top: 2px>");
print("<font class=link><b> $row_news[1]</FONT>");
print("</TD></TR><tr><TD ALIGN=LEFT HEIGHT=1><IMG SRC=images/layout/1.jpg WIDTH=200 HEIGHT=1 BORDER=0 ALIGN=LEFT></TD></TR><TR VALIGN=TOP><TD ALIGN=LEFT HEIGHT=1> ");
print("<font class=news-data>$row_news[2].$row_news[3].$row_news[4] $row_news[5]</FONT><br>");
print("</TD></TR><tr STYLE=\"padding-top: 5px\"><TD VALIGN=TOP ><font class=link2>$row_news[6]<br></font></TD></TR> ");
$result_komentarze = mysql_query("select * from komentarze where news_id = '$row_news[0]';");
$ile = mysql_num_rows($result_komentarze);
print("<tr><TD ALIGN=RIGHT VALIGN=TOP><a class=text href=?dzial=komentarze&id=$row_news[0]>Zobacz komentarze ($ile)<br></A></TD></TR></TABLE><br>");
}
}
?>
Gdzieś tutaj jest błąd ze sql'em :
Kod
$result_komentarze = mysql_query("select * from komentarze where news_id = '$row_news[0]';");
$ile = mysql_num_rows($result_komentarze);
print("
$ile = mysql_num_rows($result_komentarze);
print("
Tylko gdzie ?
Pomocy !
Aha bym zapomniał taki błąd się wyświetla :
Cytat
Warning: Supplied argument is not a valid MySQL result resource in c:\usr\krasnal\www\news\news.php on line 14