I have done a program who show a list of youtube video and when I click on one of them, I open a bootstrap modal. There I want input some data to video_time_table
. It is working whithout problems, but I need to input the video_id_nr
from the video_name_table
into the video_time_table
to link them together. It working OK on my first try. Next try it stop on the insert_timestamp.php
. The data is inserted into the database but the page is empty and only show message "Successfully inserted". After some 10 minutes it working correct one time again.
Here is a link to the original code: http://technotip.com/2208/insert-data-into-mysql-jquery-ajax-php/
I have tried to close the page and reopen it, but still it not working until I have waited about 10 minutes. Then when I reload de pages it work one time again.
This is the input of the video_id_nr
in the modal :
<div class="form-group">
<label>Video id number</label>
<input type="text" class="form-control" name="video_id_nr" value='<?
php echo $videoId ?>'>
</div>
This is the database code: insert_timestamp.php
where the program is trapped second try. It start working 10 minutes later.
<?php require_once('connVideoAlbum.php');
mysql_select_db($database_connKomponent, $connKomponent);
$startime = $_POST['event_start_time'];
$stoptime = $_POST['event_stop_time'];
$info = $_POST['event_info'];
$video_id_nr = $_POST['video_id_nr'];
$squery ="INSERT INTO video_time_table(event_start_time,
event_stop_time,event_info,video_id_nr)
VALUES ('$startime','$stoptime','$info','$video_id_nr')";
if(mysql_query($squery, $connKomponent)){
echo "Succsessfully inserted";
}else{
echo "Insertion failed";
}
mysql_close();
?>
This is the javascript:
$("#sub").click( function() {
$.post( $("#myForm").attr("action"),
$("#myForm :input").serializeArray(),
function(info){ $("#result").html(info);
});
clearInput();
});
$("#myForm").submit( function() {
return false;
});