2
$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');

Right now the above code works. However instead of running the query twice is there a way to throw that into an array in 1 query. I am not proficient in vtiger and adb.

Draco
  • 118
  • 2
  • 11

1 Answers1

2

Sure, You can use query_result_rowdata() method. This method will return an associative array of row. Please have a look on the snippet.

$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

Salim
  • 196
  • 8
  • Thanks it works great. Only thing I had to do was add an "a" to your "$db->" . Confused me for a good minute though. THANKS AGAIN. – Draco Jul 19 '14 at 14:55