简体   繁体   中英

how can i get mysql results with alphabetical pagination

how can i get mysql results with alphabetical pagination ie i have 2 fields ie id and name in mysql table and following html links for pagination

ABCDEFG .......

by clicking on A i want to get results names starting with A

how can i do that with php

使用SQL LIKE语法:

SELECT * FROM tablename WHERE name LIKE 'A%'

Use a query like

SELECT `id`, `name` FROM `table` WHERE `name` LIKE :index

Then, bind :index to something like sprintf('%s%%', $selectedIndex)

It would also be a good idea to create an index on the name column.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM