Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/icure/doctor/
Upload File :
Current File : /var/www/html/mmishra/icure/doctor/daily_medications.inc

<h3 align='left'>Dated Medications</h3>
<center>
<?php

$tbl = 'medications';
$datetime = $_POST["datetime"];

if (!$datetime) $datetime = date("Y-m");

$pgno = $_REQUEST["pgno"];
if (!$pgno) $pgno = 0;          
                        
$pgsz = 30;     

$sql = "select med_name as medicine,dis_datetime as dated,qty,a.login_id as staff 
from $tbl as a, medicines as b 
where a.med_id=b.med_id and dis_datetime like '$datetime%' order by dis_id desc limit $pgno,$pgsz";

//echo list_tabledata($sql);

$rs = mysql_query($sql);
                
if (mysql_num_rows($rs)) {
        $colHeads = mysql_num_fields($rs);
        
        $str = "<table border='1' width='90%'><tr><th>Sr</th>";
        for ($i=0; $i < $colHeads; $i++) { // Header
                $str .= "<th>".ucwords(str_replace("_"," ",mysql_field_name($rs, $i)))."</th>";
        }
        $str .= "</tr>";
	$j = $pgno;                        
        while ($row = mysql_fetch_row($rs)) { //data
                $j++;
                $str .= "<tr><td>$j</td><td>".implode($row,'</td><td>')."</td></tr>";
        }
        $str .= "</table>";
} else {
        $str = "---";
}
echo $str;

if ($pgno) {
        $pgno = $pgno - $pgsz;
        echo "[ <a href='?pg=$pg&pgno=$pgno'>Previous</a> ] ";
        $pgno = $pgno + $pgsz;
}
if ($j % $pgsz == 0) {
        $pgno = $pgno + $pgsz;
        echo " [ <a href='?pg=$pg&pgno=$pgno'>Next</a> ]";
}

?>
</center>