我想将 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%
)
我要插入数据库的代码
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'};
}
但是我无法在我的数据库中插入lead-commission、expire-date、manufactur-date,你能帮我如何插入这些字段吗?