Sorry for the bump, but this script runs without any errors when feeding it an xml file, but nothing appears in my database table :S
<?php
$database_handle = mysql_connect('localhost', 'eksempel_bruker', 'eksempel_passord');
if (!database_handle) {
echo "Could not connect";
}
$db_selected = mysql_select_db('connect_shout', $link);
if (!$db_selected) {
die ('Can\'t use foo : ' . mysql_error());
}
$target_path = "./";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
$x = simplexml_load_string(file_get_contents($target_path));
$source = (string)$x->data->attributes()->source;
$reply = (string)$x->data->attributes()->reply_to;
$message = (string)$x->message;
$sql = "INSERT INTO `shout_data` VALUES(NULL,'$source','$reply','$message');";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
Any ideas?