douxiaochun4964 2013-03-26 14:50
浏览 15
已采纳

一个PHP脚本,自动将新闻分类到页面? [关闭]

I am working on a news based website.The thing is I want my site to be like other news sites.in which the news have thumbnails and if there is no room for them,the older news would go to the next page!I just want to have a general idea about this.Is there some kind of programming behind this kind of work(that every time you want to add a news,the program automatically sorts it and give it a thumbnail)and or should the admin of the page(me in this case for example) rewrite the html file of the news?I hope I made my self clear enough about what I want to do!

  • 写回答

2条回答 默认 最新

  • douxin0251 2013-03-26 14:53
    关注

    Yes, when you query the database you're going to want to LIMIT your query to a certain number results, and also set a start and an end to the query. See a tutorial here

    Example:

    $sql = "SELECT * FROM students ORDER BY name ASC LIMIT 0, 20";
    

    When the next button is clicked, for example, your next query might look like this:

    $sql = "SELECT * FROM students ORDER BY name ASC LIMIT 20, 20";  -- Start from 20, and take 20
    

    You would use some server side language to keep track of where the query started and left off.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入