CREATE TABLE IF NOT EXISTS `member` (
`member_id` int(11) NOT NULL auto_increment,
`member_name` varchar(120) NOT NULL,
`member_addr` text NOT NULL,
`member_phone` varchar(10) NOT NULL,
`member_group` varchar(20) NOT NULL default 'user',
PRIMARY KEY (`member_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ;
<?
include "config.php";
$search = $_REQUEST["search"];
$sql="select * from member where member_id like '%$search%'
or member_name like '%$search%'
or member_addr like '%$search%'
or member_phone like '%$search%'";
$result=mysql_db_query($dbname,$sql);
$NRow=mysql_num_rows($result);
if($NRow==0){
echo "Empty data";
}
else{
echo "<table width=100%>";
echo "<tr>
<td width=10%><u>ID</u></td>
<td width=30%><div class=TabletxtStyle><u>Name</u></div></td>
<td width=30%><u>Address</u></td>
<td width=20%><u>Phone</u></td>
<td width=10%><u>Group</u></td>
</tr>";
while($row=mysql_fetch_array($result)){
$member_id=$row['member_id'];
$member_name=$row['member_name'];
$member_addr=$row['member_addr'];
$member_phone=$row['member_phone'];
$member_group=$row['member_group'];
echo "<tr>";
echo "<td>$member_id</td>
<td>$member_name</td>
<td>$member_addr</td>
<td>$member_phone</td>
<td>$member_group</td>";
echo "</tr>";
}
echo "</table>";
}
?>
javaquery.js
Code (JavaScript)
var req;
var rnd=Math.random();
function createXMLHttpRequest()
{
if (window.XMLHttpRequest)
req=new XMLHttpRequest();
else if (window.ActiveXObject)
req=new ActiveXObject("Microsoft.XMLHTTP");
else{
alert("Browser not support");
return false;
}
}
function call_send()
{
createXMLHttpRequest();
var search=document.getElementById("search").value;
var querystr="show.php?qID="+rnd+"&search="+search;
req.onreadystatechange = statechange;
req.open("post",querystr,true);
req.send(null);
}
function statechange()
{
if (req.readyState==4) {
var x=document.getElementById("cell1");
x.innerHTML = req.responseText;
}
else{
var x=document.getElementById("cell1");
x.innerHTML="<img src=images/indicator.gif border=0> Please wait...";
}
}
function updateName(){
}