Preliminary PHP: A simple mysql database paging program template

zhaozj2021-02-12  174

Below is a simple PHP connection MySQL database for data paging display. You can modify it by comment notes, and the SQL statement inside can be changed.

Pay attention to the writing and implementation of the code to be analyzed and observed in the relevant paged part.

// Insert your HTML code here, count; $ show = 20; $ TOTALPAGE = CEIL ($ RecountCount / $ show); $ Page = ($ _ Get ['Page']) && $ _GET ['Page']> = 0)? $ _get ['Page']: 0; $ Islast = ($ Page == ($ TOTALPAGE-1))? True: false; $ Hasnopre = ($ page == 0)? True: false; $ HASNOONEXT = ($ page == $ TOTALPAGE-1)? True: false; $ isfirst = ($ PAGE == 0)? True: false; $ start = $ Page * $ show; mysql_free_result ($ result);> // Insert your HTML code here, <$ sql = "SELECT * from Your_Table Limit $ Start, $ Show "; $ Result = mysql_query ($ SQL) or Die (MySQL_ERRNO ().": ":"); "/ n"); while ($ r = mysql_fetch_object ($ result) {/ / HTML code in this loop is more actually modified Echo $ RS-> Art_ID; echo "
";} mysql_free_result ($ result);?>

转载请注明原文地址:https://www.9cbs.com/read-6122.html

New Post(0)