<!doctype HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ""
< Meta http-equiv= "Content-type" content= "text/html;" charset=gb2312 "/>
<title>php the data submitted by Ajax in the query is not synchronized with the database tutorial </title>
| code is as follows |
copy code |
|
<script language= "Web Effects"
function GetSource (pageindex,pagesize,divid)
{
if (typeof (pageindex) = " Undefined "| | typeof (pagesize) = = "undifined")
{
pageindex = 0;
& nbsp; pagesize = 5;
}
var url = "getlist.php?pageindex=" +pageindex+ "&pagesize=" +pagesize;
var divs = document.getElementById (divID);
var ajax = Initajax ();
Ajax.open ("Get", url,true);
ajax.onreadystatechange = function ()
{
if (ajax.readystate = 4)
{
divs.innerhtml = Ajax.responsetext;
}
}
ajax.send (null);
}
</script> |
<body>
getlist.php File Code
| code is as follows |
copy code |
<?php
Header ("CONTENT-TYPE:TEXT/HTML;CHARSET=GBK");
require_once ' conndb.php ';
$pageindex = $_get["pageindex"];
$pagesize = $_get["pagesize"];
MySQL tutorial _query ("Set names GBK");
$getcont = "SELECT count (*) as Cott from address";
$sourt = mysql_query ($getcont);
$contt = mysql_result ($sourt, 0, ' Cott ');
$sql = "SELECT * From address Limit". ($pageindex * $pagesize). "," . $pagesize;
$source = mysql_query ($sql);
$row = mysql_num_rows ($source);
for ($i = 0; $i < $row; $i + +)
{
//echo ........
}
Mysql_close ();
?
|
Data in PHP that submits queries with Ajax is not synchronized with the database
</body>