gpt4 book ai didi

php - order by rand() 给大帖子带来麻烦

转载 作者:行者123 更新时间:2023-11-29 05:43:28 24 4
gpt4 key购买 nike

我有这段代码,这段代码遇到了麻烦,需要执行很多时间来显示来自数据库的随机帖子:

$totalrows = 10;

$sql = "SELECT
posts.Tags as tags,
posts.OwnerUserId as postsid,
posts.Id as postid,
posts.Body as body,
posts.Title as title,
users.Id as userid,
users.DisplayName as usersname
FROM posts
JOIN users ON posts.OwnerUserId = users.Id
WHERE posts.Title != '' order by rand() asc limit " . $totalrows;

$r = mysql_query($sql) or die(mysql_error());

请告诉我应该如何更改才能更快地显示随机帖子?

问候,丹

最佳答案

关于php - order by rand() 给大帖子带来麻烦,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4644600/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com