Im putting together a simple script that pulls content from the tweetmeme api and then inserts it into a database for further formating. This is what i currently have but it inserts no records and returns no errors for the database connection so i can assume it connects and fails at the insertion.
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '****';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'footy';
mysql_select_db($dbname) or die('Couldnt connect to database table');
$tweetmeme = "http://api.tweetmeme.com/stories/popular.xml?category=sports-soccer&count=30" ;
$xml = @simplexml_load_file($tweetmeme) or die ("no file loaded") ;
echo count($xml->stories->story)."stories in the XML file<br /><br />";
echo $xml->getName() . "<br /><br />";
foreach($xml->stories->story as $story)
{
$title=$story->title;
$url=$story->url;
$media_type=$story->media_type;
$created=$story->created_at;
//$current_time=$date();
$url_count=$story->url_count;
$comment_count=$story->comment_count;
$excerpt=$story->excerpt;
$sql = "INSERT INTO ft_tweets (title,url,media_type,created_at,mention_count,comment_count,excerpt) VALUES ($title,$url,$media_type,$created,$url_count,$comment_count,$excerpt)";
$result = mysql_query($sql);
doing a vardump() on the various items returns "object(SimpleXMLElement)" and this is what the xml structure looks like for an example link text