$condition = '200,310'; //these are numbers of pages for news to be driven out of

while (list($key,$nesto) = each($pluginid))
{
 $getnm = $DB->query("SELECT articleid, categoryid FROM " . TABLE_PREFIX . "p".$nesto."_newy
                    WHERE lang = '$userlang'
                    AND settings > 0
                    **AND instr(categoryid, $condition)**
                    ORDER BY settings ASC, datecreated DESC");
$rows = $DB->get_num_rows($getnm);
}


instr不起作用。任何想法如何使它起作用? categoryid包含一个数字。

最佳答案

如果要检查categoryid是否是$ condition中提供的任何一个,则必须切换参数的位置:

AND instr('$condition', categoryid) > 0

关于php - instr()查询不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7877585/

10-13 22:22