jemz — 2012-11-15T05:04:05-05:00 — #1
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.
guido2004 — 2012-11-15T08:13:53-05:00 — #2
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?
jemz — 2012-11-15T09:28:23-05:00 — #3
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.
guido2004 — 2012-11-16T02:35:41-05:00 — #4
I don't understand. If it works, what is the problem?
jemz — 2012-11-16T07:07:07-05:00 — #5
if it is a video,then it fails.
frank1 — 2012-11-17T23:14:34-05:00 — #6
first thing you can do is check what LAST_INSERT_ID() is returing inside the function(if both queries are are running successfully)
jemz — 2012-11-18T23:44:13-05:00 — #7
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.