Question

I am trying to upload a video and save the link to the database. I have wrote the code but I am getting this error. Doe someone know what I am doing wrong?

$name = $_FILES['file']['name'];
$temp = $_FILES['file']['tmp_name'];

move_uploaded_file($temp,"uploaded/".$name);
$file = "http://127.0.0.1/webapp/video%20upload%20and%20playback/uploaded/$name";

mysql_query("
    INSERT INTO oefeningen (`Id`, `Fname`, `Lname`, `namevideo`, `video`, `expl`)
    VALUES (NULL, '$fname', '$lname', ,'$namevideo', '$file','$expl')
") or die (mysql_error());

thx!

The error i am getting is:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''test.mov', 'http://127.0.0.1/webapp/video%20upload%20and%20playback/uploade' at line 2  
Was it helpful?

Solution

$lname', ,'$namevideo',

You have an extra comma so it should be

$lname', '$namevideo',
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top