Welcome Guest, Not a member yet? Register   Sign In
trying to create an array for XML-RPC = FAIL
#1

[eluser]skattabrain[/eluser]
I'm not creating my array to send of as an XML-RPC response correctly.

1 record ... this works ... but how do I use the foreach statement to add records into my array? I'm askign this way because everything I've tried FAILS. Also ... doing this Fails as well (I think it's because I'm using ODBC, not MySQL ...

return $this->xmlrpc->send_response($query->result_array());

Here's my function ... how would you go about looping it? Please don't tell me that $items is overwriting itself in each loop, I know this. I'm posting this here as is because it's the only way I can it going at all. I usually do soemthing below but XML-RPC rejects it ...

Code:
foreach($query->result() as $item)
{
$items[$item->someuniquestring_or_a_counter] =    
            array(              
                'CustomerNo' => array($qitem->CustomerNo,'string'),
                'CustomerName' => array($qitem->CustomerName,'string')
                );
}

I've tried array_push ... no dice.

This is day 2 of XML-RPC/ODBC HELL ... Please save me.

Code:
function test()
    {
        $query = $this->db->query("SELECT * FROM AR_Customer");
        
        $items = array();
        
        foreach($query->result() as $item)
        {
            $items =    
            array(              
                'CustomerNo' => array($item->CustomerNo,'string'),
                'CustomerName' => array($item->CustomerName,'string')
                );
        }
        
        $response = array($items, 'struct');

        return $this->xmlrpc->send_response($response);    
    }


Messages In This Thread
trying to create an array for XML-RPC = FAIL - by El Forum - 12-02-2008, 05:25 PM
trying to create an array for XML-RPC = FAIL - by El Forum - 12-02-2008, 11:36 PM
trying to create an array for XML-RPC = FAIL - by El Forum - 12-03-2008, 07:56 AM
trying to create an array for XML-RPC = FAIL - by El Forum - 12-03-2008, 09:50 AM
trying to create an array for XML-RPC = FAIL - by El Forum - 12-03-2008, 10:17 AM
trying to create an array for XML-RPC = FAIL - by El Forum - 02-13-2009, 06:37 AM
trying to create an array for XML-RPC = FAIL - by El Forum - 02-24-2009, 02:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB