我有一个要在查询中使用的数组:
Array ( [0] => stdClass Object ( [followee] => 267,269,270,271,272,273,275,276,277,278,279 ) )
我不确定为什么它返回消息:
Object of class stdClass could not be converted to string.
Controller :
$data['activity'] = $this->home_model->activity($followID);
型号:
function activity($followID)
{
$query_str = 'SELECT DISTINCT name
FROM place
WHERE userid IN ("'. implode('","', $followID) .'")';
$query = $this->db->query($query_str);
最佳答案
尝试$your_array[0]->followee
。
关于php - 将数组转换为字符串 MySQL 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11338897/