【发布时间】:2017-07-12 08:56:43
【问题描述】:
我有数组值作为原因
例如:$cause = $_REQUEST['cause'];
即,$cause = 2,3,4
如何从查询中获取该数组值原因名称
我的表名是'cp_cause'
如何从上表中得到2,3,4的原因名称。
我在 thinkphp 中的示例查询模型是
$cause_name = $GLOBALS['db']->getAll("select category from ".DB_PREFIX."category where id = '".$cause."'");
我想要劳动力、健康、女性的名称
【问题讨论】:
-
你问怎么办
WHERE id IN (2,3,4)? -
我有 2,3,4,但我只希望 ids 名称像 labour,health,women