RaaapuLis Posted August 13, 2008 Report Share Posted August 13, 2008 kr4 man piem. ir gars komentārs, un kā lai es to komentāru samazinu nu teiksim līdz 30 pirmajiem simboliem un tad 3 daudz punktes Lai butu nevis asdskdhsajkdbagfasdl\msdkykvnhalmvdf Bet gan asdskdhsa... Link to comment Share on other sites More sharing options...
Ownmen Posted August 13, 2008 Report Share Posted August 13, 2008 (edited) tu vinju velc no MySQL datubāzes vai kā? ja tā tad iemer savu mysql_query(); un vietu, kur tu izdrukā komentāru Edited August 13, 2008 by Ownmen Link to comment Share on other sites More sharing options...
RaaapuLis Posted August 13, 2008 Author Report Share Posted August 13, 2008 jap no mysql $result=mysql_query("SELECT id, raksta_id, niks, komentaars, datums FROM komentaari"); while($row = mysql_fetch_array($result, MYSQL_NUM)) { echo " <table style='padding:2px' border='1' cellspacing='0' cellpadding='5'> <tr> <td>$row[0]</td> <td>$row[1]</td> <td>$row[2]</td> <td>$row[3]</td> </tr> </table>"; Link to comment Share on other sites More sharing options...
Ownmen Posted August 13, 2008 Report Share Posted August 13, 2008 sry pa dubultpostu bet paņem vnk šo funkciju: function CropSentence ($strText, $intLength, $strTrail) { $wsCount = 0; $intTempSize = 0; $intTotalLen = 0; $intLength = $intLength - strlen($strTrail); $strTemp = ""; if (strlen($strText) > $intLength) { $arrTemp = explode(" ", $strText); foreach ($arrTemp as $x) { if (strlen($strTemp) <= $intLength) $strTemp .= " " . $x; } $CropSentence = $strTemp . $strTrail; } else { $CropSentence = $strText; } return $CropSentence; } $strTemp = "Hello, I am a fish and you are not."; $strTemp = CropSentence($strTemp, 16, "..."); print $strTemp; ?> Link to comment Share on other sites More sharing options...
RaaapuLis Posted August 13, 2008 Author Report Share Posted August 13, 2008 (edited) kāds dubultposts? un kur man vinjā būtu jāliek? pēc vai pirms kvērija? Edited August 13, 2008 by RaaapuLis Link to comment Share on other sites More sharing options...
Ownmen Posted August 13, 2008 Report Share Posted August 13, 2008 ai pagaidi es aatri labaaku uzraxtiishu šis kaut kaads ljevais, netaa uz aatro atradu, biki uzgaidi Link to comment Share on other sites More sharing options...
RaaapuLis Posted August 13, 2008 Author Report Share Posted August 13, 2008 ok nau kru steigties Link to comment Share on other sites More sharing options...
Ownmen Posted August 13, 2008 Report Share Posted August 13, 2008 paņem un izdari šādi: substr($row[3], 0, 3); un ja $row[3] ir komentaars (kaa tam vajadzeetu buut), tad tev no vinja panjems 3 pirmos burtus to ... vari pats pielikt Link to comment Share on other sites More sharing options...
RaaapuLis Posted August 13, 2008 Author Report Share Posted August 13, 2008 (edited) Liels paldies Ownmenam par lielisko palīdzību :* :D a kā izdzēst komentaru no db? Edited August 13, 2008 by RaaapuLis Link to comment Share on other sites More sharing options...
Ownmen Posted August 13, 2008 Report Share Posted August 13, 2008 <?php if(isset($_GET['dzest']) and ctype_digit($_GET['dzest'])) { mysql_query("DELETE FROM komentaari WHERE id = '$_GET['dzest']'"); } ?> <a href="?dzest=<?php echo $row[0]; ?>">Dzēst</a> Link to comment Share on other sites More sharing options...
brazer Posted August 13, 2008 Report Share Posted August 13, 2008 (edited) dzēšat ārā postu. Edited August 13, 2008 by brazer Link to comment Share on other sites More sharing options...
RaaapuLis Posted August 13, 2008 Author Report Share Posted August 13, 2008 (edited) ko tu neteiksi brazer, ka tik +1 postu dabūt ne? paldies ownmenam, atkal.. Edited August 13, 2008 by RaaapuLis Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now