Php. Adding New Column To An Array, But Is Doubling Up The Results

What I am trying to do is to add a new column into the array so I can put these 2 columns into it:

uuid1 . '-' . uuid2

What it is doing is that it is doubling up the results like:

$base = \Query::Create() ->Database('main') ->Select( 'devices.id', 'devices.uuid1', 'devices.uuid2') ->From('devices') ->where(column('deleted_on'), is, new \DBNull()) ->limit(5); try { $MySqlItems = $base->Execute(); foreach ($MySqlItems as $list_item) { $list_item['result'] = ""; array_push($MySqlItems, $list_item); } } catch(\Exception $ex) {} Copy code

From another page:

$response['MySql'] = $MySqlData; Copy code

Results:

"MySql": [ { "id": "64", "uuid1": "1318", "uuid2": "52366" }, { "id": "296", "uuid1": "17304", "uuid2": "10994" }, { "id": "445", "uuid1": "17488", "uuid2": "57404" }, { "id": "64", "uuid1": "1318", "uuid2": "52366", "result": "1318-52366" What I want the result to be like. }, { "id": "296", "uuid1": "17304", "uuid2": "10994", "result": }, { "id": "445", "uuid1": "17488", "uuid2": "57404", "result": } ] Copy code

Any ideas on what I am doing wrong here?

Tag » Add Column To Array Php