douquejituan938904 2013-03-01 01:23
浏览 38
已采纳

我如何每隔30天从我的MySQL数据库中显示一个随机行? [关闭]

I am working on my members system and I want to display a "Featured Member" in the sidebar every 30 days, I want the selection to be random. Any ideas? Tips?

EDIT: I understand how to query the database to display a random row, I was wondering what I would have to do to display the data every 30 days

  • 写回答

3条回答 默认 最新

  • dq13733519262 2013-03-01 01:35
    关注

    This is actually 2 questions:

    ~ get a random member

    ~ display a member for 30 days

    The first part can be done using the SQL query from JW or by a range of other query methods.

    The second part has to be done using PHP. There are a number of ways to do this and the most interesting part of your problem to me is changing it every 30 days.

    Personally I'd either a cron job or use one a solutions based around whatever month it is and storing the random member with reference to that month stamp. If the month stamp changed the random member stored changes. Something like that.

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

报告相同问题?

悬赏问题

  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应