Adsense
Popular Posts
- Code update from PHP 7.4 to PHP 8.1 - PhpSpreadsheet
- MySQL workbench -"Could not decrypt password cache"
- Code update from PHP 7.4 to PHP 8.1 - Worksheet/Iterator.php
- Rendering HTML tags inside textarea
- axios handle blob type data
- Unix Utils and wget in Windows
- increase mysql query speed
- Setup vi syntax for PHP
- Get WAMP running on EC2
- EXCEL return to the next line in the same cell
Thursday, July 3, 2014
Add an associative array in MySQL result row - PHP
I extract each row from MySQL in PHP, now I want to add an associative array in each row.
PHP function array_merge is used.
public function get_salary() {
$c = new Connection();
$items = array("StartTerm" => 0,"EndTerm" => 1000, "sort"=>0, "EmploymentGroup"=>0 );
while($row = $c->getArray($result)){
// add associate array $row and $items and return it to $results
$results[] = array_merge($row, $items);
}
return $results;
}
part of code in models in PHP CodeIgniter
Labels:
php
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment