Assume I\'m calling search through AJAX. Now I want to call another AJAX on the page that will be loaded by AJAX and can be edited.
PHP page of my application in this live search with pagination i am applied
" onUnload="msg()" bgcolor="#CCCCCC">
and this is my Handlerpage.php
0)
{
$pages=ceil($n/3);
$i=0;
echo "Pages : ";
while($i<$pages)
{
echo "";
$i=$i+1;
}
echo "
";
}
else
{
echo "No Record Found";
}
}
//============================================Selected record Display By Button========================================
//==========================================Display Record for static Record==========================================
function disp_Record($btn)
{
$cn=mysql_connect("localhost","root","");
mysql_select_db("per_info",$cn);
//$btn=1;
$query="SELECT u.p_id 'ID', u.p_name 'NAME', u.p_add 'ADDRESS', l1.loc_name 'CITY', l2.loc_name
'STATE',u.p_gen
'GENDER', u.p_photo 'PIC', u.p_phone 'PH'
FROM p_info u, tbl_state l1, tbl_state l2
WHERE u.p_city = l1.loc_id
AND l2.loc_id = l1.loc_parent ORDER BY u.p_id desc LIMIT ".$btn.", 3";
$rs = mysql_query($query);
echo "
Name
Address
City
State
Gender
Photo
Phone No
";
while($row=mysql_fetch_array($rs))
{
echo "
".$row['NAME']."
".$row['ADDRESS']."
".$row['CITY']."
".$row['STATE']."
";if($row['GENDER']=="1")
{
echo "Male";
}
else
{
echo "Female";
}
echo "
";
echo "".$row['PH']."
";
}
}
//==========================================================Live search By Button=====================================
function live_search_pages()
{
$txt=$_GET['txt'];
$cn=mysql_connect("localhost","root","");
mysql_select_db("per_info",$cn);
$query="SELECT count(*) 'TR' from p_info where p_name like '".$txt."%'";
$rs = mysql_query($query);
$rec = mysql_fetch_array($rs);
$n=$rec['TR'];
if($n>0)
{
$pages=ceil($n/3);
$i=0;
echo "Pages : ";
while($i<$pages)
{
echo "";
$i=$i+1;
}
echo "
";
}
else
{
echo "No record Found";
}
}
//================================================================Live search==========================================
function live_search($btn,$text)
{
$txt=$_GET['findR'];
$text=$_GET['text'];
$cn=mysql_connect("localhost","root","");
mysql_select_db("per_info",$cn);
if($text==null)
{
$query="SELECT u.p_id 'ID', u.p_name 'NAME', u.p_add 'ADDRESS', l1.loc_name 'CITY', l2.loc_name 'STATE', u.p_gen
'GENDER', u.p_photo 'PIC', u.p_phone 'PH'
FROM p_info u, tbl_state l1, tbl_state l2
WHERE u.p_city = l1.loc_id
AND l2.loc_id = l1.loc_parent
AND u.p_name LIKE '".$txt."%' ORDER BY u.p_id desc LIMIT ".$btn.", 3";
}
else
{
$query="SELECT u.p_id 'ID', u.p_name 'NAME', u.p_add 'ADDRESS', l1.loc_name 'CITY', l2.loc_name 'STATE',u.p_gen
'GENDER', u.p_photo 'PIC', u.p_phone 'PH'
FROM p_info u, tbl_state l1, tbl_state l2
WHERE u.p_city = l1.loc_id
AND l2.loc_id = l1.loc_parent
AND u.p_name LIKE '".$text."%' ORDER BY u.p_id desc LIMIT ".$btn.", 3";
}
if($rs=mysql_query($query))
{
echo "
Name
Address
City
State
Gender
Photo
Phone No
";
while($row=mysql_fetch_array($rs))
{
echo "
".$row['NAME']."
".$row['ADDRESS']."
".$row['CITY']."
".$row['STATE']."
";if($row['GENDER']=="1")
{
echo "Male";
}
else
{
echo "Female";
}
echo "
";
echo "".$row['PH']."
";
}
}
else
{
echo "error";
}
}
?>
I hope that it will helps you
- 热议问题