Jump to content
php.lv forumi

Recommended Posts

Posted

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!

Posted

izskatās ka zirgs tik māk tik bļaut uz citiem, bet izlasīt ko pats sarakstījis nemāk. tur tak nav neviens cikls cauri komentāriem, kā gan vairāk par vienu komentāru rādīsies?

Posted

skaidrs ... nu ja neko noderigu nemak uzrakstit (KAC) tad kapec radit savu "krutumu"!

skaidrs v3rb0 paldies tev ka pateici atskj. no dazhiem labiem ...

×
×
  • Create New...