-2
我是fecthing它错了吗?我使用FETCH_ASSOC
它不能正常工作,有人可以帮我吗?我不知道什么是错用它
这是我的代码我在fecthing它错了吗? FETCH_ASSOC
if(!empty($_POST)){
if (isset($_POST['id']) && $_POST['id'] > 0){
$id=$_POST['id'];
GetSuppliersView();
}
}
function GetSuppliersView() {
global $db;
global $id;
try{
$query = $db->query("
SELECT
suppliers.*,
third_party_services.name as servicename
FROM
suppliers
INNER JOIN
suppliers_services
ON
suppliers.id = suppliers_services.supplier_id
LEFT JOIN
third_party_services
ON
suppliers_services.id = third_party_services.id
WHERE
suppliers_services.supplier_id = $id
");
$row=$query->fetch(PDO::FETCH_ASSOC);
$result['success'] = true;
$result['result'] = $row;
echo json_encode($result);
return true;
} catch (PDOException $pe) {
return false;
}
}
你能帮助我吗?
哪里了'$ result'是从哪里来的? – Swellar
我觉得你的意思'$结果= $查询 - >取(PDO :: FETCH_ASSOC);'和'不$行= $查询 - >取(PDO :: FETCH_ASSOC);' – Swellar
反过来错误报告,找出 – Ghost