Jump to content
php.lv forumi

izmet tikai vienu komentaru


zirgs

Recommended Posts

Nu man ir shads skripts:

<?php

include 'db_con.php';

$numb = $_GET['numb'];
settype($numb,"integer");

if(!empty($_GET['numb']))
{
$sql = mysql_query("select * from news where id = '$numb'");
$num = mysql_num_rows($sql);
$sql_k = mysql_query("select * from komentari where zinjuid = '$numb' order by id desc");

if($num == 1)
{
$row = mysql_fetch_array($sql);
$row_k = mysql_fetch_array($sql_k);
$t = $row["t"];
$d = $row["d"];
$n = $row["n"];
$iz = $row["iz"];
$au = $row_k["au"];
$co = $row_k["co"];
$cod = $row_k["cod"];

echo "<span id=virs>";
echo $t;
echo "</span><br />";
echo "<span id=dat>";
echo $d;
echo "</span><br />";
echo $n;
echo "<br /><br /><br /><br /><br />";
echo "<span id=au>";
echo $au;
echo "</span><br />";
echo "<span id=dat>";
echo $cod;
echo "</span><br />";
echo $co;
echo "<br /><br />";

}
}


if(empty($_GET['numb']) OR $num <> 1)
{
$sql = mysql_query("select * from zinjas order by id desc");
while($row = mysql_fetch_array($sql))
{
echo "<span id=virs><a href=zinjas.php?numb=";
echo $row["id"];
echo ">";
echo $row["t"];
echo "</a></span><br />";
echo "<span id=dat>";
echo $row["d"];
echo "</span><br />";
echo $row["iz"];
echo "<br /><br />";
echo "<div class=komentari>";
echo "<a href=zinjas.php>Komentari</a>";
echo "</div>";

}
}

?>

un itka kad nesaku likt klat komentarus tad viss gaaja kaa pa sviestu ... bet tagad attiec zinjas komentaros rada tkai 1 komentaru(kaut datubaze ir vairaki,attiec. pedejo vai pirmo ka ir uzlikts order by) ... kursh zin ? izmegjinaju visadi ... paldies!

Link to comment
Share on other sites

×
×
  • Create New...