| Current Path : /var/www/html/mmishra/icure/admin/ |
| Current File : /var/www/html/mmishra/icure/admin/students.inc |
<h3 align='left'>Student Roll</h3>
<center>
<?php
$tbl = 'students';
$sname = $_REQUEST["sname"];
$pgno = $_REQUEST["pgno"];
if (!$pgno) $pgno = 0;
$pgsz = 100;
?>
Student RollNo or Name <input type='text' name='sname' value='<?php echo $sname; ?>' size='15'>
<input type='submit' name='submit' value='FIND'>
<a href='?pg=student&rollno='>New</a><br>
<?php
if ($sname) {
$sql = "select roll_no,name_eng as name,dob,gender,hostel_no,room_no,c_ph_no as contact
from $tbl where roll_no like '$sname%' or name_eng like '%$sname%' order by name_eng limit $pgno,$pgsz";
} else {
$sql = "select roll_no,name_eng as name,dob,gender,hostel_no,room_no,c_ph_no as contact
from $tbl order by name_eng limit $pgno,$pgsz";
}
$rs = mysql_query($sql);
if (mysql_num_rows($rs)) {
$colHeads = mysql_num_fields($rs);
echo "<table border='1' width='90%'><tr><th>Sr</th>";
for ($i=0; $i < $colHeads; $i++) { // Header
$fld = ucwords(str_replace("_"," ",mysql_field_name($rs, $i)));
echo "<th>$fld</th>";
}
echo "</tr>";
$j = $pgno;
while ($row = mysql_fetch_row($rs)) { //data
$j++;
echo "<tr><td><a href='?pg=student&rollno=".$row[0]."'>$j</a></td><td>".implode($row,'</td><td>')."</td></tr>";
}
echo "</table>";
if ($pgno) {
$pgno = $pgno - $pgsz;
echo "[ <a href='?pg=$pg&sname=$sname&pgno=$pgno'>Previous</a> ] ";
$pgno = $pgno + $pgsz;
}
if ($j % $pgsz == 0) {
$pgno = $pgno + $pgsz;
echo " [ <a href='?pg=$pg&sname=$sname&pgno=$pgno'>Next</a> ]";
}
} else {
echo "---";
}
?>
</center>