Adsense
Popular Posts
- jQuery autocomplete scroll bar for dropdown menu
- mod_auth_cas.so error: undefined symbol: SSL_connect
- JavaScript Arrays and Associate Arrays
- Design date and signature box in Latex
- JavaScript, remove trailing insignificant zeros after toFixed function
- Install APXS in Redhat Linux
- jQuery, toggle the display
- Difference between state and props in React
- super(props) in React
- MySQL workbench -"Could not decrypt password cache"
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