06-05-2009, 10:04 AM
|
#1 (permalink)
|
|
The Wanderer
Join Date: Nov 2007
Location: Edinburgh
Posts: 21
Thanks: 1
|
Funny Parse -> MySQL Insert error
Im parsing a feed, then entering the data into mysql.
When i echo $elemt->title or any of the others, it shows the correct value.
However when i insert it, its just blank....
Some help pl0x?
PHP Code:
include_once ('functions.php');
$xmlobj = simplexml_load_file("http://www.colingilchrist.com/feeds/posts/default");
$channel = $xmlobj;
foreach ($channel as $element) {
$title = $element->title;
$content = $element->content;
$time = strtotime($element->published);
echo $element->title;
#$check_query = mysql_query("SELECT * FROM `blog` WHERE `title` LIKE '%".$elemt->title."%'");
#$check = mysql_num_rows($check_query);
#if($check != 1) {
mysql_query("INSERT INTO `blog` (
`user`,
`title`,
`message`,
`time`) VALUES(
'Colin',
'".$element->title."',
'".$element->content."',
'".$element->published."')");
#}
}
|
|
|
|