Sie sind auf Seite 1von 3

<?

php
//include_once "./include/defined.inc.php";
//include_once INCLUDE_LIB.'config.inc.php';
sqlite_close($db);
?>

<?php
echo '<br><center>'."<font color='#ff00ff' size='4'>WRHQ - Interactive Mobile
Number search</center><br>";

if(!isset($_POST['grade']) && !isset($_POST['dept']) && !isset($_POST['cl']) &&


!isset($_POST['mobno']) && !isset($_POST['name'])) {
$pg = $_GET['page']*10+1;
$grade = $_GET['grade'];
$dept = $_GET['dept'];
$cl = $_GET['cl'];
$mobno = $_GET['mobno'];
$name = $_GET['name'];
}
//echo '<br>Page:'.$pg;

echo"<form method=\"POST\" action=\"$PHP_SELF\"><font color='#ff00ff'>


Grade:<select name=\"grade\">
<option > </option>
<option >E1</option>
<option >E2</option>
<option >E2A</option>
<option >E3</option>
<option >E4</option>
<option >E5</option>
<option >E6</option>
<option >E7</option>
<option >E7A</option>
<option >E8</option>
<option >E9</option>
<option >S3</option>
<option >W4</option>
<option >W9</option></select>
Department:<select name=\"dept\"></font>
<option > </option>
<option >C&M</option>
<option >COMML.</option>
<option >ENGG</option>
<option >ENGG(NEW PROJ)</option>
<option >ENGG (PROJ MONITG).</option>
<option >ENGG(SAFETY)</option>
<option >EXEC DIR SECT</option>
<option >FINANCE</option>
<option >HR</option>
<option >INSPECTION</option>
<option >IT</option>
<option >IT(CIVIL)</option>
<option >OS</option>
<option >RGPPL</option>
<option >TECH SERVICES</option>
<option >Corporate Centre</option></select>

Cluster:<select name=\"cl\"></font>
<option > </option>
<option >1</option>
<option >2</option>
<option >3</option>
<option >4</option>
<option >5</option>
<option >6</option>
<option >7</option>
<option >8</option>
<option >9</option>
<option >10</option>
<option >cc</option>
</select>

&nbsp &nbsp Mob no:<input type=\"text\" size=8 name=\"mobno\">


<br><p>Name:<input type=\"text\" size=30 name=\"name\">
<input type=\"submit\" name=\"submit\" value=\"search\"</form>";

if(isset($_POST['grade']) || isset($_POST['dept']) || isset($_POST['cl']) ||


isset($_POST['mobno']) || isset($_POST['name'])) {
$grade = $_POST['grade'];
$dept = $_POST['dept'];
$cl = $_POST['cl'];
$mobno = $_POST['mobno'];
$name = $_POST['name'];
$l=0;
}

if($dept =="Corporate Centre") { $dept=""; $cl="cc"; }


//echo $dept. ' &nbsp '. $cl;

$db = sqlite_open("mobile");

$result = sqlite_query($db,"SELECT empno,name,grade,dept,dob,cluster,mobile from


employee where ( grade like '%$grade%' AND dept like '%$dept%' AND cluster like '%
$cl%' AND mobile like '%$mobno%' and name like '%$name%' ) order by name asc");
echo '<br>'.$x;

$row = sqlite_num_rows($result);

$lc = $row/10 + 1;
//if ($row>20) $row=$row-1;
printf('<br> Total Pages Found:%d &nbsp &nbsp Total entries found:%d',$lc,$row);
//echo"<p>View:";
for($i=0;$i<=$row/10+1;$i++){
//printf("<a href=\"%s?grade=%s&&dept=%s&&cl=%s&&mobno=%s&&name=%s&&page=%s\">Page
%d</a> ",$PHP_SELF,$grade,$dept,$cl,$mobno,$name,$i,$i);
}

$pg = $_GET['page']*20+0;
if($row<=20) $pg=0;
$l = $_GET['page'];
$k = $_GET['page'];

if($pg>$lc) { $pg=$i; }
if($_GET['page']<=$lc) $pg = $_GET['page']*20+0;
//and ($k+1)*10<=$row )
//if( ($k+1)*10<=$row and $k*10+10>=0 )

if($k<=0) $k=0;
if($k>=$lc) $k=$lc;
if($k>=0 and $k<=$lc) {

printf("<p><a href=\"%s?grade=%s&&dept=%s&&cl=%s&&mobno=%s&&name=%s&&page=
%d\">Prev Page (%d)</a> &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp <a href=\"%s?grade=
%s&&dept=%s&&cl=%s&&mobno=%s&&name=%s&&page=%d\">Next Page (+%d)</a> ",$PHP_SELF,
$grade,$dept,$cl,$mobno,$name,$k-1,$k-1,
$PHP_SELF,$grade,$dept,$cl,$mobno,$name,$k+1,$k+1);

$str1 = "SELECT empno,name,grade,dept,dob,cluster,mobile from employee where


( grade like '%$grade%' AND dept like '%$dept%' AND cluster like '%$cl%' AND
mobile like '%$mobno%' and name like '%$name%' ) order by name asc limit $pg,20 ";

//echo '<br>'.$str1;

$result1 = sqlite_query($db,$str1);

printf("<p>");
echo"<table border=2>\n";

echo"<tr> <td><font color='#aa0000'>Sl no</td>


<td><font color='#aa0000'>Emp no</td>
<td><font color='#aa0000'><center>Name</center></td>
<td><font color='#2424e2'><center>Grade</center></td>
<td><font color='#aa0000'><center>Department</center>
<td><font color='#2424e2'><center>Mobile No</center></td>
<tr>\n";
$p=0;
while ($row = sqlite_fetch_array($result1)) {
$p = $p+1;
//$p = ($pg-$i)*20+$p;
printf("<b><tr><td><font color='#ff00ff'>%d</td>
<td><font color='#ff00ff'>%.8s</td>
<td><font color='#000088'>%s</td>
<td><font color='#804000'>%s</td>
<td><font color='#004466'>%s</td>
<td><font color='#004466'>%s</td> ",
$p,$row[empno],$row[name],$row[grade],$row[dept],$row[mobile]);

}
echo"</table>\n";
//print_r($row);

?>

Das könnte Ihnen auch gefallen