I have the following array result returning from a table when called from xmlrpc client and want to send the this response to client side.
array(17) {
["A"]=>
int(1)
["B"]=>
int(0)
["pnl"]=>
int(1)
["C"]=>
int(1)
["buttons"]=>
array(5) {
[1]=>
string(9) "ABC"
[2]=>
string(5) "DEF"
[3]=>
string(5) "G"
[4]=>
string(7) "H"
[5]=>
string(9) "I"
}
["List"]=>
string(580) "<th title="S">Ticker</th><th title="Position - Shares Held in Portfolio">Pos</th><th title="Average Cost">Cost</th><th title="Current Market Price">Price</th>"
}
Currently using the following code to fetch the record but it returns undefined offsets .i got the above result using the var_dump function which contains all the data fetched . how can i change my loop to get the result in appropriate row?
var_dump($model) ;
for ($i = 0; $i < count($model); ++$i) { $xml_rpc_rows[$i] = array($model[$i], 'struct'); } } $response = array( $xml_rpc_rows, 'struct'); return $this->xmlrpc->send_response($response);
foreachforeach()check if desired$variableis fit for foreach or you'll get errors (in views mostly).