gpt4 book ai didi

php数组导入mysql

转载 作者:行者123 更新时间:2023-11-29 04:30:55 24 4
gpt4 key购买 nike

$sql_where = ''; $exclude = '30,35,36,122,123,124,125';

if($exclude != '') 
{
$exclude_forums = explode(',', $exclude);
foreach ($exclude_forums as $id)
{
if ($id > 0)
{
$sql_where = ' AND forum_id <> ' . trim($id);
}
}
}

$sql = 'SELECT topic_title, forum_id, topic_id, topic_type, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_time
FROM ' . TOPICS_TABLE . '
WHERE topic_status <> 2
AND topic_approved = 1
' . $sql_where . '
ORDER BY topic_time DESC';

上面的代码我用来排除要在 sql 查询中显示的论坛 id。

为什么不行还显示呢?

任何解决方案

最佳答案

您在 =

之前遗漏了点
$sql_where .= ' AND forum_id <> ' . trim($id);

关于php数组导入mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2612580/

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