Welcome Guest, Not a member yet? Register   Sign In
Setting csrf_regenerate as TRUE
#7

(This post was last modified: 07-28-2017, 01:59 AM by Martin7483.)

First
Why don't you use the PHP function json_encode?
Your two foreach loops can be done in 1 foreach and there is no need to create a json string in that manner.

Second
I'm not going to write the code for you.
You have all the pieces of the puzzle, and it shouldn't be that hard to figure out.
Looking at your code you should be able to do it

But to help you out a bit

PHP Code:
$departments = array();
foreach (
$loop as $row)
{
 
   $departments[] = array('id'=>$row['id'],'name'=>$row['name']);
}
 
$response['departments'] = $departments
Reply


Messages In This Thread
Setting csrf_regenerate as TRUE - by june123 - 07-27-2017, 04:45 AM
RE: Setting csrf_regenerate as TRUE - by june123 - 07-27-2017, 08:27 AM
RE: Setting csrf_regenerate as TRUE - by spjonez - 07-27-2017, 06:21 AM
RE: Setting csrf_regenerate as TRUE - by june123 - 07-28-2017, 01:36 AM
RE: Setting csrf_regenerate as TRUE - by Martin7483 - 07-28-2017, 01:58 AM
RE: Setting csrf_regenerate as TRUE - by june123 - 07-28-2017, 06:15 AM
RE: Setting csrf_regenerate as TRUE - by june123 - 07-28-2017, 11:50 PM
RE: Setting csrf_regenerate as TRUE - by june123 - 07-31-2017, 12:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB