Lovefist233
18-03-07, 18:25
OK, I don't know any php really so i'm really stuck here, I got this code from about.com and it is supposed to handle a file upload and a mysql insert (making a video blog) but I get \"parse error: unexpected T_VARIABLE in line 8\"
can anyone shed some light on this for me please?
<?php
//This is the directory where images will be saved
$target = \"video/\";
$target = $target . basename( $_FILES['video']['name']
//This gets all the other information from the form
$name = $_POST['title'];
$caption = $_POST['caption'];
$date = $_POST['date'];
$video = ($_FILES['video']['name']);
// Connects to your Database
mysql_connect(\"localhost\", \"admin\", \"password\") or die(mysql_error());
mysql_select_db(\"vlg_videoblog\") or die(mysql_error());
//Writes the information to the database
mysql_query(\"INSERT INTO `vlg_article_art` (title_art, caption_art, date_art, video_art)
VALUES ('$name', '$caption', '$date', '$video')\");
//Writes the photo to the server
if(move_uploaded_file($_FILES['video']['tmp_name'], $target)){
//Tells you if its all ok
echo \"The file \". basename( $_FILES['uploadedfile']['name']). \" has been uploaded, and your information has been added to the directory
<a href=\"index.php\">Back To Index</A>\"; }
else {
//Gives and error if its not
echo \"Sorry, there was a problem uploading your file. please <a href=\"post2.php\">Try Again</a>\";
}
?>
line 8, for you lazy ones is the line that starts with $name
can anyone shed some light on this for me please?
<?php
//This is the directory where images will be saved
$target = \"video/\";
$target = $target . basename( $_FILES['video']['name']
//This gets all the other information from the form
$name = $_POST['title'];
$caption = $_POST['caption'];
$date = $_POST['date'];
$video = ($_FILES['video']['name']);
// Connects to your Database
mysql_connect(\"localhost\", \"admin\", \"password\") or die(mysql_error());
mysql_select_db(\"vlg_videoblog\") or die(mysql_error());
//Writes the information to the database
mysql_query(\"INSERT INTO `vlg_article_art` (title_art, caption_art, date_art, video_art)
VALUES ('$name', '$caption', '$date', '$video')\");
//Writes the photo to the server
if(move_uploaded_file($_FILES['video']['tmp_name'], $target)){
//Tells you if its all ok
echo \"The file \". basename( $_FILES['uploadedfile']['name']). \" has been uploaded, and your information has been added to the directory
<a href=\"index.php\">Back To Index</A>\"; }
else {
//Gives and error if its not
echo \"Sorry, there was a problem uploading your file. please <a href=\"post2.php\">Try Again</a>\";
}
?>
line 8, for you lazy ones is the line that starts with $name