dongpo2002 2019-06-04 13:51
浏览 179

如何动态插入mysql

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;    
    });
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器