| Current Path : /var/www/html/mmishra/sip/ |
| Current File : /var/www/html/mmishra/sip/index.php |
<?php
require("init.inc.php");
echo $header;
?>
<br>
<center>
<?php
if (!$user) {
echo "<table border='9'><tr><td>
UID <input type='text' name='txtID' value='' size='15'>
PWD <input type='password' name='txtPWD' value='' size='15'>
<input type='submit' name='login' value='LOGIN'>
</td></tr></table>";
}
$tbl = 'students';
$sqls = array("select course_name course, count(r_number) no from $tbl group by course_name",
"select year batch, count(r_number) no from $tbl group by year",
"select communication_address_state state, count(r_number) no from $tbl group by communication_address_state",
"select category, count(r_number) no from $tbl group by category",
"select gender, count(r_number) no from $tbl group by gender",
"select area, count(r_number) no from $tbl group by area",
"select bg blood, count(r_number) no from $tbl group by bg",
"select insurance, count(r_number) no from $tbl group by insurance",
"select religion, count(r_number) no from $tbl group by religion"
);
$rs = mysql_query("select count(r_number) no from $tbl");
if (mysql_num_rows($rs)) {
$o = mysql_fetch_object($rs);
$no = $o->no;
}
?>
[ <a href='guest/'>Guest access</a> ]
</center>
<h3>Meta Data - <?php echo $no; ?> Students Distribution</h3>
<center>
<?php
echo "<table width='80%' border='1'><tr valign='top'>";
foreach ($sqls as $sql) {
$rs = mysql_query($sql);
if (mysql_num_rows($rs)) {
$colHeads = mysql_num_fields($rs);
echo "<th width='33%'>
<table border='0' width='90%' align='center'><tr>";
for ($i=0; $i < $colHeads; $i++) { // Header
$fld = ucwords(str_replace("_"," ",mysql_field_name($rs, $i)));
echo "<th>$fld</th>";
}
echo "</tr>";
while ($row = mysql_fetch_row($rs)) { //data
$j++;
if ($j % 2 == 0)
echo "<tr bgcolor='#BDEDFF'><td>".implode($row,'</td><td>')."</td></tr>";
else
echo "<tr><td>".implode($row,'</td><td>')."</td></tr>\n";
}
echo "</table></th>";
} else {
echo "<td>Sorry! record could not be found.</td>";
}
$k++;
if ($k % 3 == 0) echo "</tr><tr valign='top'>";
}
echo "</tr></table>
</center>";
echo $footer;
?>