在这里,我收到错误,
Notice: Trying to get property of non-object
在获取记录时的最后两行。 它说什么? 我的代码:
$Id = $_REQUEST['id'];
$sql = "Select * From ".CHANNEL_MASTER."
Where sam_status = '".ACTIVE_STATUS."' And user_id = '".$_SESSION['user_id']."' And sam_id = '".$Id."'";
$db->query($sql);
$row = $db->fetch_object(MYSQL_FETCH_SINGLE);
$siteID = array_search($row->sam_site_id, $site_id_array);
$ebay_token = $row->sam_ebay_token;
答案 0 :(得分:0)
您需要将查询结果存储到变量中,然后从中获取数据。
所以而不是
$db->query($sql);
$row = $db->fetch_object(MYSQL_FETCH_SINGLE);
使用
$result=$db->query($sql);// store query result into $result
$row = $result->fetch_object(MYSQL_FETCH_SINGLE);// fetch data from $result
答案 1 :(得分:0)
$Id = $_REQUEST['id'];
$sql = "Select * From ".CHANNEL_MASTER."
Where sam_status = '".ACTIVE_STATUS."' And user_id = '".$_SESSION['user_id']."' And sam_id = '".$Id."'";
$result = $db->query($sql);
$row = $result->fetch_object(MYSQL_FETCH_SINGLE);
$siteID = array_search($row->sam_site_id, $site_id_array);
$ebay_token = $row->sam_ebay_token;