I have a book in a database and I want to display pages from and to. For example
From Page 5 to Page 7..
How would I do this? Right now I am able to get pages From only:
For ex;
$getPages = mysql_query("SELECT * FROM book WHERE pags='5'") or die(mysql_error());
while($rowPages = mysql_fetch_array($getPages)) {
$page = $rowAR['pageText'];
echo $page;
}
$getPages = mysql_query("SELECT * FROM book WHERE pags>='5' AND pags<='7'") or die(mysql_error());
假设您的数据库表每行包含一页:
SELECT * FROM book WHERE page BETWEEN 5 AND 7
You can use the LIMIT command of MYSQL to return certain rows:
Ex.
SELECT * FROM books LIMIT 15, 30
This script returns the first 30 rows after row 15 in the books table.
Other sample: SELECT * FROM tbl LIMIT 5,10; # Retrieve rows 6-15
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.