| Current Path : /var/www/html/mmishra/indem/phq-bak/backup/ |
| Current File : /var/www/html/mmishra/indem/phq-bak/backup/search_results.php |
<?php
$link = mysql_connect("localhost", "alad", "tinp4db");
mysql_select_db("upp");
$myvalue = $_REQUEST['myvalue'];
$myfield = strtoupper($_REQUEST['myfield']);
if ($myfield == 'PNO') $fld = $myfield; else $fld = substr($myfield, 0, strlen($myfield)-2);
if (isset($_REQUEST['myvalue']) && strlen($_REQUEST['myvalue'])>2){
echo "<b>Search Results</b><hr><ol>";
$rs = mysql_query("select * from personal_info where " .$myfield. " like '" . $myvalue . "%'", $link);
if (mysql_num_rows($rs) > 1){
while ($o = mysql_fetch_object($rs)){
echo "<li><a href='index.php?url=search&myfield=pno&myvalue=" . $o->pno . "'>" . $o->pno . "</a> - ";
//echo "<li><a href='/' onclick=\"show_names('PNO',$o->pno); return false;\">" . $o->pno . "</a> - ";
echo $o->name_e . " (<span id='hindi'>" . $o->name_h . "</span></b>)";
if ($o->sex == 'Male') echo " S"; else echo " D";
echo "/o. " . $o->father_name_e . " (<span id='hindi'>" . $o->father_name_h . "</span>)</li>";
}
}elseif (mysql_num_rows($rs) == 1){
$arr = mysql_fetch_array($rs);
if ($pno == '') $pno = $arr['pno'];
$num_fields = mysql_num_fields($rs);
?>
<table width='90%'>
<tr><th>English</th><th>Hindi</th></tr>
<tr><th colspan='2'>Personal Information</th></tr>
<tr valign='top'><td>
<?php
for ($y = 0; $y < $num_fields; $y++){
if (!strpos(mysql_field_name($rs, $y), "_h")){
echo "<b>" . ucwords(strtr(mysql_field_name($rs, $y), "_", " ")) . "</b> : ";
echo "<font size=1px>" . $arr[$y] . "</font><br>";
}
}
echo "</td><td>";
for ($y = 0; $y < $num_fields; $y++){
$fld = mysql_field_name($rs, $y);
$lb = mysql_query("select hindi_label from labels where attribute='$fld'", $link);
if (mysql_num_rows($lb)){
$q = mysql_fetch_object($lb);
echo "<span id='hindi'>" . $q->hindi_label . "</span> : ";
}else{
echo "<b>" . ucwords(strtr($fld, "_", " ")) . "</b> : ";
}
echo "<span id='hindi'>" . $arr[$y] . "</span><br>";
}
?>
</ol></td></tr>
<tr><th colspan='2'>Service Information</th></tr>
<tr valign='top'><td>
<?php
$rs = mysql_query("select * from service_info where pno='$pno'", $link);
$arr = mysql_fetch_array($rs);
$num_fields = mysql_num_fields($rs);
for ($y = 0; $y < $num_fields; $y++){
if (!strpos(mysql_field_name($rs, $y), "_h")){
echo "<b>" . ucwords(strtr(mysql_field_name($rs, $y), "_", " ")) . "</b> : ";
echo "<font size=1px>" . $arr[$y] . "</font><br>";
}
}
echo "</td><td>";
for ($y = 0; $y < $num_fields; $y++){
if (strpos(mysql_field_name($rs, $y), "_h")){
echo "<b>" . ucwords(strtr(mysql_field_name($rs, $y), "_", " ")) . "</b> : ";
echo "<span id='hindi'>" . $arr[$y] . "</span><br>";
}
}
echo "</td></tr></table>";
}else{
echo "Record not found." .$myfield . $myvalue;
}
}
?>