<?php
session_start();
include("dbf.php");
include_once('jdf.php');
$d=jdate('Y/m/d');
$contents = "<html><head><link rel='stylesheet' href='css/sp.css' type='text/css' /><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head><body>";
$tbla=$_SESSION[tbl];
$que=$_SESSION[qury];
$fieldsu=$_SESSION[fieldsu];
$contents .="<table border='1'  cellspacing='0.75' cellpadding='3' dir='rtl'  align='left' width='500' >";
$contents.="<tr><td align='center' colspan='13'><table><tr><td align='center' style='padding-top:10px'><a onClick='back(\"getajax.php\")' style='cursor:pointer;text-decoration:none'><span ><b>$_SESSION[city]<b/></span></a></td></tr>";
$contents.="<tr><td align='center' style='padding-top:10px'><span><b>$_SESSION[head]<b/></span></td></tr>";
$contents.="<tr><td align='left'  style='padding-top:10px;padding-bottom:10px'><span >  تاريخ :  $d </td></tr>";
$contents.="</table></td></tr><tr>";

$contents.="<td align='center' style='font-size: 9pt;' bgcolor='gray'><b>ردیف</span></td>";
foreach($fieldsu as $name => $value)
$contents .= "<td align='center' style='font-size: 9pt;' bgcolor='gray'><b>$name</td>";

$contents .="</tr>";
$q=mysql_query($que)or die(mysql_error());
$i2=1;
while($r=mysql_fetch_array($q))
{
$contents .="<tr>";
$contents.="<td align='center'><span>$i2</span></td>";
foreach($fieldsu as $name => $value)
  $contents .= "<td align='center'><span>$r[$value]</span></td>";
$contents .="</tr>";
$i2++;
}
$contents .="</table>";
$contents .= "</body></html>";
echo $contents;

?>