Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/irp/operator/
Upload File :
Current File : /var/www/html/mmishra/irp/operator/departments.php

<?php
require_once("../init.inc.php");

//exit on session expiry
if (!$user) header("Location: /");

if ($role == 'guest') {
	header("Location: guest/");
}

$tbl = 'departments';

echo $header;

?>
<h2>Departments</h2>
<center>

<?php
$query = "select * from $tbl";

/* create a prepared statement */
if ($stmt = $mysqli->prepare($query)) {

	/* bind parameters for markers */
	//$stmt->bind_param("s", $indent_no);
	/* execute statement */
	$stmt->execute();

	/* bind result variables */
	$stmt->bind_result($dept_code, $dept_name, $account_no, $financial_year,$fund_granted,$expenditure,$balance,hod_name);

		echo "<table width='90%' border='1' style='border-collapse: collapse'>
		<tr><th>Indented By</th><th>Designation</th><th>Department</th><th>Recommended By</th></tr>";
		/* fetch values */
		while ($stmt->fetch()) {
			echo "<tr><td>$indentor</td><td>$designation</td><td>$department</td><td>$recommended_by</td></tr>";
		}
		echo "</table>";
		/* close statement */
		$stmt->close();
	}
$rs = mysql_query("select * from $tbl order by dept_code");
if (mysql_num_rows($rs)) {
    $colHeads = mysql_num_fields($rs);

	echo "<table width='90%' border='1' style='border-collapse: collapse'>
	<tr><th>No.</th>";
	for ($i=0; $i < $colHeads; $i++) { // Header
		$fld = ucwords(str_replace("_", " ", mysql_field_name($rs, $i)));
		echo "<th>$fld</th>"; 
	}

	echo "</tr>\n";

	while ($row = mysql_fetch_row($rs)) { //data
		$no++; 
		echo "<tr><td>$no</td><td>".implode($row,'</td><td>')."</td></tr>\n"; 
	}
	echo "</table>";
}
?>

</center>

<?php

echo $footer;

?>