2013-01-07 58 views
-6

我想插入XML數據到數據庫中,但某些領域不會插入 我有這樣如何插入XML數據到數據庫

SimpleXMLElement Object (
    [person-id] => 4562 
    [name] => gopi 
    [category] => working 
    [lead-commission] => SimpleXMLElement Object () 
    [expire-date] => SimpleXMLElement Object () 
    [manufactur-date] => SimpleXMLElement Object () 
    [type] => medicine [sale-commission] => 1.00% 
) 

我的代碼的XML數據插入到數據庫

foreach($xml->link AS $value) 
{ 
    $data['person-id']= $value->{'person-id'}; 
    $data['name']= $value->{'name'}; 
    $data['category']= $value->{'category'}; 
    $data['lead-commission']= $value->{'lead-commission'}; 
    $data['expire-date']= $value->{'expire-date'}; 
    $data['manufacture-date']= $value->{'manufactur-date'}; 
    $data['type']= $value->{'type'}; 
    $data['sale-commission']= $value->{'sale-commission'}; 
} 

但我不能夠插入鉛佣金到期最新製造最新在我的數據庫可以請你幫我如何將這個字段

+1

希望這裏的一些機器人將能夠制定出您的粘貼和幫助你;) – Happy

+0

這些屬性顯示爲(可能是空的)XML節點。你能舉一個XML本身的例子嗎? – Phil

+0

正如您從轉儲中可以清楚地看到的那樣,'lead-commission,expire-date,manufacture-date'是XML對象...您必須更深入! – Supericy

回答