Array
(
[0] => Array
(
[Title] => SimpleXMLElement Object
(
[0] => aa
)
[Pubdate] => SimpleXMLElement Object
(
[0] => aa
)
[Link] => SimpleXMLElement Object
(
[0] => aa
)
)
[1] => Array
(
[Title] => SimpleXMLElement Object
(
[0] => bb
)
[Pubdate] => SimpleXMLElement Object
(
[0] => bb
)
[Link] => SimpleXMLElement Object
(
[0] => bb
)
)
我想把它放到一个以(Title,Pubdate,Link)为列的表中。当我遇到SimpleXMLElement Object and [0]
时,我真的很困惑如何把它放到mysql表中。如果那些不在路上,我很容易把它放到桌子上,但因为那些在那里而且我以前从未见过它,我非常困惑。
这就是我的尝试:
foreach($string as $item){
INSERT into table (Title, Pubdate, Link)VALUES($item->title, $item->pubDate, $item->link)
}
仅供参考我这是我制作阵列的方式:
$string = $con->channel->item;
$table = array();
foreach ($string as $item) {
$table[] = array(
'Title' => $item->title,
'Pubdate' => $item->pubDate,
'Link' => $item->link
);
}
答案 0 :(得分:1)
您不能只在数据库中插入它。先破坏数组。
试试这个:
=SUM(IF(FREQUENCY(IF(E1=$A$1:$C$3,ROW($A$1:$C$3)),IF(E1=$A$1:$C$3,ROW($A$1:$C$3)))>0,1))
答案 1 :(得分:1)
为什么这不起作用? 你尝试的时候会发生什么?
sudo apt-get install libprotobuf-dev protobuf-compiler
答案 2 :(得分:1)
尝试这样的事情......
// output array, to store in database
$result = array();
foreach($table as $key => $simpleXml) {
$result[$key] = $simpleXml->asXML();
}
// gets your result as a string => you can now insert it into mysql
$dbInsertion = serialize($result);