Faks Posted September 21, 2010 Report Share Posted September 21, 2010 (edited) Labdien Kungi Un Damas :) . Ienakt ! Lietotaja Vards support un kods tiesi tads pats varat aplukot kas un ka :) lai varetu spriest par visu . Papild Informacija . Jaunumu sadla un Komentari ir atsaviskas datubazes tabulas seit ir piemers news un comment . Edited October 10, 2010 by Faks Link to comment Share on other sites More sharing options...
Kemito Posted September 21, 2010 Report Share Posted September 21, 2010 Komentāriem piešķir katram klāt vēlvienu lauciņu, kurā ieraksti attiecīgo ID nummuriņu ( Jaunuma / Ziņu ), un ar GET velc ārā, kas kuram pieder, ja to tu vēlējies uzzināt :) Link to comment Share on other sites More sharing options...
Faks Posted September 21, 2010 Author Report Share Posted September 21, 2010 (edited) Komentāriem piešķir katram klāt vēlvienu lauciņu, kurā ieraksti attiecīgo ID nummuriņu ( Jaunuma / Ziņu ), un ar GET velc ārā, kas kuram pieder, ja to tu vēlējies uzzināt :) bet palasi manu kodu kads vins ir :) es jau laprat visu uzrakstitu tikai redzi kods man ir ! Edited September 21, 2010 by Faks Link to comment Share on other sites More sharing options...
edi Posted September 21, 2010 Report Share Posted September 21, 2010 (edited) parbaudot tikai ar pliku mysql_real_escape_string nepietiek) http://faksx.sytes.net/blogs/?page=comment&comment_id=5 izdzes pedejos 3 ierakstus. kods diezgan vienkas var teikt bez parbaudem un diezgan divaina veida tiek pievienoti komentari :) Edited September 21, 2010 by edi Link to comment Share on other sites More sharing options...
Faks Posted September 21, 2010 Author Report Share Posted September 21, 2010 (edited) parbaudot tikai ar pliku mysql_real_escape_string nepietiek) http://faksx.sytes.net/blogs/?page=comment&comment_id=5 izdzes pedejos 3 ierakstus. kods diezgan vienkas var teikt bez parbaudem un diezgan divaina veida tiek pievienoti komentari :) Patlaban vins velk id ara no news nevins no komentaru sadalas . komentaru comment_id nemaz vel pilnigi nau uzrakstit vins tagad iznak strada uz uz news nevins taka vinam atbilst . un pietiks mazoties pie komentariem :) tur tiks cita forma uzlika kad bus vis ejos tad vares tikai tekstu pienmt un ciparu parejais tiks blokets vari savu joku pameginat ar report :) Edited September 21, 2010 by Faks Link to comment Share on other sites More sharing options...
edi Posted September 21, 2010 Report Share Posted September 21, 2010 (edited) paradi db savadak gruti kaut ko saprast.. un uzraksti ko tev tiesi vajag vispar :D Edited September 21, 2010 by edi Link to comment Share on other sites More sharing options...
Faks Posted September 21, 2010 Author Report Share Posted September 21, 2010 (edited) paradi db savadak gruti kaut ko saprast.. un uzraksti ko tev tiesi vajag vispar :D bet vis ir skaidri redzams koda .... apaksa ir db bilde ... Edited September 21, 2010 by Faks Link to comment Share on other sites More sharing options...
edi Posted September 21, 2010 Report Share Posted September 21, 2010 (edited) iesakuma $id = isset ($_REQUEST['id']) ? abs(intval($_REQUEST['id'])) : false; $page = isset ($_GET['start']) ? trim($_GET['page']) : false; un komentarus izvadot ar htmlspecialchars() parbaudi :D un kas tev tur ar to db? vari radit ari bez ierakstiem :) cik saku saprast tu gribi katrai zinai piesaistit komentarus nevis visus visam ) neizlasiju temas nosaukumu skatos patik kengaties interesanti ka tevi te vel nau nobanojusi :)par ko mani banot) es tev cenos palidzet ))) izveido jaunu tabulu kur bus visi komentari (var ari visu viena tabula sataisit isteniba :) ) `id` int(11) NOT NULL AUTO_INCREMENT, // unikalais id ) `news_id` int(11) NOT NULL, // News id kurai konkreti tiek pievienots komentars `author` varchar(30) NOT NULL, // autors `text` text NOT NULL, // zinas teksts `date` int(11) NOT NULL, // datums ( izvelies pats ka datumu glabat) PRIMARY KEY (`id`) Edited September 21, 2010 by edi Link to comment Share on other sites More sharing options...
Faks Posted September 21, 2010 Author Report Share Posted September 21, 2010 (edited) iesakuma $id = isset ($_REQUEST['id']) ? abs(intval($_REQUEST['id'])) : false; $page = isset ($_GET['start']) ? trim($_GET['page']) : false; un komentarus izvadot ar htmlspecialchars() parbaudi :D sito idejo vajadzes izpetit man dzilak :) Edited September 21, 2010 by Faks Link to comment Share on other sites More sharing options...
Faks Posted September 21, 2010 Author Report Share Posted September 21, 2010 iesakuma $id = isset ($_REQUEST['id']) ? abs(intval($_REQUEST['id'])) : false; $page = isset ($_GET['start']) ? trim($_GET['page']) : false; un komentarus izvadot ar htmlspecialchars() parbaudi :D un kas tev tur ar to db? vari radit ari bez ierakstiem :) cik saku saprast tu gribi katrai zinai piesaistit komentarus nevis visus visam ) neizlasiju temas nosaukumu par ko mani banot) es tev cenos palidzet ))) izveido jaunu tabulu kur bus visi komentari (var ari visu viena tabula sataisit isteniba :) ) `id` int(11) NOT NULL AUTO_INCREMENT, // unikalais id ) `news_id` int(11) NOT NULL, // News id kurai konkreti tiek pievienots komentars `author` varchar(30) NOT NULL, // autors `text` text NOT NULL, // zinas teksts `date` int(11) NOT NULL, // datums ( izvelies pats ka datumu glabat) PRIMARY KEY (`id`) ja tiesi runat praktiskak ir kad komentari un news ir samergoti kopa ... bet var tak ar left join ari visu atrisinat :) vismaz ta domaju. Link to comment Share on other sites More sharing options...
edi Posted September 21, 2010 Report Share Posted September 21, 2010 ja tiesi runat praktiskak ir kad komentari un news ir samergoti kopa ... bet var tak ar left join ari visu atrisinat :) vismaz ta domaju. ja tu nesaprati tad tev no sakuma japievieno vienkasi savai tabulai `comment` jaunu lauku kur bus noradits konkretas News id un vispar nekadu left join nevajadzes izmantot :D Link to comment Share on other sites More sharing options...
Faks Posted September 21, 2010 Author Report Share Posted September 21, 2010 (edited) ja tu nesaprati tad tev no sakuma japievieno vienkasi savai tabulai `comment` jaunu lauku kur bus noradits konkretas News id un vispar nekadu left join nevajadzes izmantot :D labi ar db vis butu atrisinats :) bet ko talak butu lieksi ja izskadrotu :D jo dalu itka esu ari koda uzrakstijis vienigi neizprotu labo ideju vel ka to lidz galam realizet .... Edited September 21, 2010 by Faks Link to comment Share on other sites More sharing options...
edi Posted September 21, 2010 Report Share Posted September 21, 2010 (edited) tad kad tev atver linku Comment tev url ir comment_id ar zinas id pievienojot komentaru so id liec taja jaunaja laika kuru tu tik :D un tad atverot attiecigo lapu ar attiecigas News id izvadisi apmeram komentarus sadi $req = mysql_query("SELECT * FROM `comments` WHERE `news_id`='$id' ORDER BY ID DESC utt;"); while($arr = mysql_fetch_assoc($req)) { echo $arr['kautkas'].'<br/>'; } ar pirkstu ir daudz vieglak paradit neka paskaidrot rakstiski :D Edited September 21, 2010 by edi Link to comment Share on other sites More sharing options...
Faks Posted September 21, 2010 Author Report Share Posted September 21, 2010 (edited) koment lapa izmantiju $news_select = ("SELECT id,news_id,comment_name,comment_text,comment_datetime FROM comment WHERE 'news_id' = '$id' "); bet ir problema man ari taka vajadzeju izvilkt ara no news (news_text,news_title) .... un cik saprotu te bus vajadzigs lefjoin vai ari jums ir cits varijants ???? ne jus visi esat baigi labie iesakat un visu nomeat nost un pasi pazudat .... Edited September 21, 2010 by Faks Link to comment Share on other sites More sharing options...
edi Posted September 21, 2010 Report Share Posted September 21, 2010 (edited) ne var ari bez left join :D $news_select = ("SELECT `id`,`news_id` AS `c`,(SELECT `news_text` FROM `news` WHERE `id`=`c`) AS `news_teksts`,(SELECT `news_title` FROM `news` WHERE `id`=`c`) AS `news_title`,`comment_name`,`comment_text`,`comment_datetime` FROM comment WHERE `news_id`= '$id'; "); ja zini ka var ar left join tad izmanto vinu :) es tikai paradiju ka var ari bez vina )) ne jus visi esat baigi labie iesakat un visu nomeat nost un pasi pazudat ....nekur nepazudu vienkasi apnik Edited September 21, 2010 by edi Link to comment Share on other sites More sharing options...
Recommended Posts