DB2 PHP Generator online Help
Prev | Return to chapter overview | Next |
ExecQueryToArray
Еxecute a query that returns a result set.
Signature:
function ExecQueryToArray($sql, &$array)
Example:
$queryResult = array();
$sql = "SELECT first_name, last_name, email FROM customer WHERE active = 1";
$this->GetConnection()->ExecQueryToArray($sql, $queryResult);
foreach ($queryResult as $row) {
$customerFirstName = $row['first_name']; // you can get the first name by key
$customerFirstName = $row[0]; // or by index
$customerLastName = $row['last_name']; // you can get the last name by key
$customerLastName = $row[1]; // or by index
$customerEmail = $row['email']; // you can get the email by key
$customerEmail = $row[2]; // or by index
}
Prev | Return to chapter overview | Next |