$val){ $$key = $val; } } if($_GET != ""){ foreach($_GET as $key => $val){ $$key = $val; } } $global[name] ="thanks"; $global[title]=";Ҳ"; $tbl_name="thanks"; $body=new Smarty(); $lim=10; $sql="SELECT * FROM $tbl_name"; $res=mysql_query($sql); $ttl=mysql_num_rows($res); $ttp=ceil($ttl/$lim); if (!$p) $p=1; if ($p>1) { $prev=1; } else { $prev=0; } if ($ttp>1 and $p<$ttp) { $next=1; }else{ $next=0; } $i=0; $sql="SELECT * FROM $tbl_name ORDER BY id DESC LIMIT ".($lim*($p-1)).",$lim"; $res=mysql_query($sql); while ($row=mysql_fetch_array($res)) { $thanks[title][$i]=$row[title]; $thanks[car][$i]=$row[car]; $thanks[intro][$i]=$row[intro]; $thanks[img][$i]=$row[img1]; $i++; } $body->assign("page" ,array("self_url"=>$_SERVER[PHP_SELF],"total"=>$ttl,"page"=>$p,"prev"=>$prev,"next"=>$next)); $body->assign("thanks",$thanks); $body->assign("global" ,$global); $body->display("thanks.tpl"); ?>