错误:
类
stdClass
的对象无法转换为string
上的$logQuery
我收到了一个愚蠢的错误,但无法弄清楚:
$userName = $this->db->query("SELECT DISTINCT username FROM " . DB_PREFIX . "users WHERE user_id = '" . (int)$user_id . "'");
从其他表存储值,以便我在另一个表中使用它:
$logQuery = "insert into `" . DB_PREFIX . "user_activities` (user_id, product_id, action, data_values, time_of_action, ip_address, date_modified, username) values (" . $userId . "," . $product_id . ", 'update', '" . $updateData . "', NOW(),'" . $ipAddress . "', NOW(),'" . $userName . "')";
$this->db->query($logQuery);
其他一切正常,但$userName
。