Adsense
Popular Posts
- MySQL workbench -"Could not decrypt password cache"
- peer review (3)
- PHP, dump varailbes in a format way
- "Unusual traffic from your computer network" from blogger
- Install APXS in Redhat Linux
- JavaScript, remove trailing insignificant zeros after toFixed function
- Update member directory
- Set Windows path command line
- JavaScript: add days to current date
- DataTable table order by numeric, not by text
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