0

for example we have this

php array

$test = array(array('id'=>1, 'name'=> 'foo'), array('id'=>2, 'name'=> 'bar'));

Now the SQL statement

$sql='SELECT id, mail FROM user';

is there a way to cobine the output ON id to get a new array like

$result = array(array('id'=>1, 'name'=> 'foo', mail => 'foo@example.com'), array('id'=>2, 'name'=> 'bar', mail =>'bar@example.com'));
2
  • There is no internal function for this - buy you can write it by your own with two foreach one into another. Feb 8, 2014 at 12:33
  • How does your table look like? You will have to loop over the result array/object.
    – idmean
    Feb 8, 2014 at 12:33

1 Answer 1

0

For Combine Arrays in php Use array_push Function
you can Combine Array And Array
Or combine String And Array
By it...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.