获取类stdClass的Object无法转换为字符串

时间:2017-05-25 15:26:17

标签: php

错误:

  

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

0 个答案:

没有答案