Vtiger adb数组选择语句

时间:2014-07-18 21:41:06

标签: php sql vtiger

$sql = "SELECT * FROM vtiger_account inner join vtiger_troubletickets on vtiger_troubletickets.parent_id = vtiger_account.accountid where vtiger_troubletickets.ticketid=?";
$result = $adb->pquery($sql, array($recordId));
$customername = $adb->query_result($result,0,'accountname');
$customerphone = $adb->query_result($result,0,'phone');

现在上面的代码有效。但是,不是两次运行查询,而是在1个查询中将其抛出到数组中。我并不精通vtiger和adb。

1 个答案:

答案 0 :(得分:2)

当然,您可以使用 query_result_rowdata()方法。此方法将返回行的关联数组。 请看一下片段。

$sql = "SELECT * FROM vtiger_account inner join vtiger_troubletickets on vtiger_troubletickets.parent_id = vtiger_account.accountid where vtiger_troubletickets.ticketid=?";
$result = $adb->pquery($sql, array($recordId));
$row = $adb->query_result_rowdata($result, 0);
$customername = $row['accountname'];
$customerphone = $row['phone'];

HTH