简体   繁体   English

如何显示MySQL数据库中每个网页最多显示50个URL的列表?

[英]how do I display list of URLS say maximum 50 per web page from MySQL database?

I do have thousands of urls in my database. 我的数据库中确实有数千个网址。 what I want to do is display all urls in multiple pages say number of URLS per page is 100 and alphabetically then when ever a user search for a URL info it should get updated on relevant page. 我想做的是在多个页面中显示所有URL,说每页的URL数是100,并且按字母顺序排列,那么当用户搜索URL信息时,它应该在相关页面上进行更新。 for example if it is google.com then it should get updated on "G" page and no duplicate entry. 例如,如果它是google.com,则应该在“ G”页面上进行更新,并且没有重复的条目。 how can I do this with PHP and MySQL?? 我该如何使用PHP和MySQL?

You would need to combine a WHERE clause in your SQL with a LIMIT 0,100 or something. 您将需要在SQL中将WHERE子句与LIMIT 0,100或其他东西组合。

You can use the where clause to limit it by letter WHERE name LIKE 'G%' and you can use the limit clause to get the first 100 rows by doing LIMIT 0,100 您可以使用where子句按字母WHERE name LIKE 'G%'来限制它,还可以使用limit子句通过LIMIT 0,100获得前100行

fist of all alphabetically ordered list: 所有按字母顺序排列的列表的拳头:

SELECT url_column_name 
FROM my_table 
ORDER BY url_column_name ASC

what you wanna do is a pagination you can read about pagination here: http://hype-free.blogspot.com/2008/10/efficient-sql-pagination-method.html 您想做的是分页,您可以在这里阅读有关分页的信息: http : //hype-free.blogspot.com/2008/10/efficiency-sql-pagination-method.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从 mysql 数据库中选择随机行(比如 100 中的 10)并用数字串联显示它们 - How do I select random rows (say 10 from 100) from mysql database and display them with a number in series 在mysql表中每页显示50行,但允许搜索整个表 - Display 50 rows per page from mysql in table but allow to search whole table 单击网页中的按钮时,如何从列表中显示随机短语? - How do I display a random phrase from a list when a button is clicked in a web page? 如何通过分页从我的mysql数据库表中每页只显示5条记录? - How to display only 5 records per page from my mysql database table through pagination? 如何在mysql数据库里面显示一个表<option> - How do I display a table from mysql database inside <option> 如何从 mysql 数据库中按 ID 显示数据 - How do i display data by ID from mysql database 如何从存储在MySQL数据库中的URL下载一批图片 - How do I download a batch of pictures from URLs stored in a MySQL database 如何从MySQL数据库显示无序列表 - How to display unordered list from mysql database 如何使用jQuery Pager插件从mysql数据库中获取记录并每页显示10条结果。 请帮忙 - How to fetch records from mysql database and display 10 results per page using Jquery Pager Plugin. Please Help 如何将mysql数据库内部的html值显示到网页中 - how to display html value inside mysql database into a web page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM