Troxy Posted February 19, 2007 Report Share Posted February 19, 2007 (edited) Nu ta ir man rakst ar linku raksts.php?id=1 nu un te ir manas tabula news_id id username comment Dariju kauka shadi bet nav riktigi <?php include_once("inc/config.php"); $com_query = mysql_query("select count(*)from comments where news_id='1'"); $com_row = mysql_fetch_row($com_query); echo "".$com_row[0].""; ?> pie visiem rakstiem protams rada vienadu skaitu vajag kauka ar get laikam? noteikt raksta id ? Edited February 19, 2007 by Troxy Link to comment Share on other sites More sharing options...
Grey_Wolf Posted February 19, 2007 Report Share Posted February 19, 2007 Un kur probleema? Pats tachu devi atbildi uz savu jautaajumu... $com_query = mysql_query("select count(*)from comments where news_id=' " . $_GET['id'] . " ' " ); tikai beigaas uzmanies ar peedinjaam... to ir daudz... taapeec piemeeraa saliku atstarpes.... Link to comment Share on other sites More sharing options...
Kristabs Posted February 19, 2007 Report Share Posted February 19, 2007 $com_query = mysql_query("select count(*)from comments where news_id='".addslashes($_GET['id'])."'"); Link to comment Share on other sites More sharing options...
Troxy Posted February 19, 2007 Author Report Share Posted February 19, 2007 (edited) Te ir http://paste.php.lv/5174 mans likais kods :) Visur rada ka komenti ir 0 Kauko nesmu sapratis vai kas pietruukst PS. nepareizi izteicos man vajag skaitiit komentarus nepanemot konkreto rakstu vienkaarshi raksta beigaas cik rakstam ir komentari tas ir respektiivi neuzspiezot uz raksta http://localhost/main.php?sv=jaunumi jaunumu lapa bet vajag shite sakuma pie katra raksta http://localhost/main.php?sv=id&com=1 panemu komentet rakstu viens Edited February 19, 2007 by Troxy Link to comment Share on other sites More sharing options...
Val Posted February 19, 2007 Report Share Posted February 19, 2007 (edited) Un kā tu domā, no kuras pakaļas izrausi $com_row[0] ? un tur arī nekas nekādā gadījumā nebūtu :) Komentārus saskaiti no comments tabulas, nevis no news... Edited February 19, 2007 by Val Link to comment Share on other sites More sharing options...
Troxy Posted February 19, 2007 Author Report Share Posted February 19, 2007 shi nav komentu tabula ? :))) ko? vai tomer ir :))) $com_query = mysql_query("select count(*)from comments where news_id='".$_GET['id']."'"); Link to comment Share on other sites More sharing options...
Val Posted February 19, 2007 Report Share Posted February 19, 2007 (edited) tu tak nolasi tikai vienreiz to komentāru skaitu tam rakstam pēc $_['id'] Ciklā iet tikai pati ziņa Edited February 19, 2007 by Val Link to comment Share on other sites More sharing options...
Troxy Posted March 2, 2007 Author Report Share Posted March 2, 2007 (edited) Karoche netieku skaidriba ka tad pielikt to skaitu cik ir konkretam rakstam tie komenti Te kods http://paste.php.lv/5242 visaadi iznemos izproveju nu nesanak man Edited March 2, 2007 by Troxy Link to comment Share on other sites More sharing options...
andrisp Posted March 2, 2007 Report Share Posted March 2, 2007 $sql = "SELECT COUNT(*) FROM `komentu_tabula` WHERE news_id = ".$news_id; list($komentu_skaits) = mysql_fetch_row(mysql_query($sql)); echo $komentu_skaits; Īstos mainīgo, tabulu un lauku nosaukumus ieliec pats. Link to comment Share on other sites More sharing options...
Troxy Posted March 2, 2007 Author Report Share Posted March 2, 2007 andrisp Ja paldies tas shancee bet, Problema ir tur ka,Teiksim man ir ta Sakuma lapa Raksts 1 Te iet texts te ir poga komanteet un te pat velos to komentaru skaitu izvadiit vot ka to panaakt? Raksts 2 Te nakamais raksts uttt Te atkal poga komenteet Link to comment Share on other sites More sharing options...
andrisp Posted March 2, 2007 Report Share Posted March 2, 2007 Neredzu problēmu. Izmanto manis doto kodu, un ieliec tur, kur tev vajag. Link to comment Share on other sites More sharing options...
Recommended Posts