Hi, can you help me please i am having problem in uploading the video.the length of my video is 5.88mb and the format is .ogv,when i am going to upload this it will message like this.
FAILED TO INSERTCannot add or update a child row: a foreign key constraint fails (
tbl_mname_ibfk_1 FOREIGN KEY (
but when i am going to upload text file or some exe file like firefox,it will succesfully uploaded..i am confuse why it will not upload the movie.
I also check in the firebug and this is the error..
The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol.
can you help me please.Thank you in advance.
Are you trying to add a row to the table with a mf_id that doesn't exist in the table the foreign key points to?
Hi, Thank you for the reply,This is how i created my table
but why is that if i will just upload word document it will successfully inserted and it wil save to my database.
$conn = mysql_connect('localhost','root','');
$createTB = "create table if not exists tbl_movie(
id int not null auto_increment,
echo "Table tbl_movie has been successfully created";
$createTB2 = "create table if not exists tbl_mname(
mn_id int not null auto_increment,
foreign key (mf_id) references tbl_movie(id))";
echo "Table tbl_movie_name has been successfully created";
And this is how i inserted...
$sql = "INSERT INTO tbl_movie values(default,'$video_F','$type','$size','$tmp_nme')";
return 'not succesfully inserted';
return 'succesfully inserted';
$sql = "insert into tbl_mname values(default,
$result = mysql_query($sql);
return ("FAILED TO INSERT".mysql_error());
return 'succesfully inserted tbl_mname';
Please help me thank you in advance.
I don't understand. If it works, what is the problem?
if it is a video,then it fails.
first thing you can do is check what LAST_INSERT_ID() is returing inside the function(if both queries are are running successfully)
I got the solution,it is in the php.ini the max_uploaded_size...i change it to bigger size,and now it's working i can upload the movie file.
This topic is now closed. New replies are no longer allowed.