php + ajax + mysql pagination

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_27984879/article/details/90694742

MySQL's basic query

  • Basic query
  • Conditions inquiry
  • Projection inquiry

Paging query

limit M offset N
  • M pageSize on the number of page impressions per page
  • Start from the first few N

Shorthand:

limit N,M

Example:
From the t_blogstable, the query typeis equal 1in time to the new sort from long, selected 10item, is calculated from the article 0

select * from t_blogs where type = 1 order by date limit 10 offset 0;
  • When N exceeds the total amount of the offset data set, no error, it returns an empty set

A large amount of data paging query

未做深入研究,mysql本身就不支持大数据量.

  • Joint index
  • Check out the id, each individual query

Bring up the total amount of data

php mysql operation

  • mysql extension
  • mysqli extension
  • pdo_mysql extension

Prevent sql injection

Introduction to AJAX

var request = new XMLHttpRequest();

//http请求状态变化回调
request.onreadystatechange = function () {
	//成功完成
	if(request.readyState == 4){
		if(request.status == 200){
			return succes(request.respnseText);
		}else{
			return fail(request.respnseText);
		}
	}
}

request.open('GET','URL');
request.send();

Guess you like

Origin blog.csdn.net/qq_27984879/article/details/90694742