如何在给定的javascript中从数据库中获取数据?

时间:2018-11-15 05:13:11

标签: javascript

var mysql2_data=[{"seconds_left":"600000"}]

var client_start=Date.now()
 function timeDiff_fromseconds(target) {
    function z(n) {return (n<10? '0' : '') + n;}
    var timeDiff =target-(Date.now()-client_start)
    var hours    = timeDiff / 3.6e6 | 0;
    var minutes  = timeDiff % 3.6e6 / 6e4 | 0;
    var seconds  = timeDiff % 6e4 / 1e3 | 0;
    if (hours<0 || minutes<0 || seconds<0) {   
      return '<b>EXPIRED</b>';
      }
    else {
      return '<b>' + z(hours) + '</b> Hours, <b>' + z(minutes) + '</b>  Mins, <b>' + z(seconds) + '</b> Secs';
      }
    };

setInterval(function(){
timer2.innerHTML=timeDiff_fromseconds(mysql2_data[0].seconds_left,client_start)
},1000);
<h5>Timer Here:</h5>
<div id="timer2"></div>

  

Blockquote   我正在使用此查询“从闪存中选择timestampdiff(SECOND,now(),duration)seconds_left”

如何从存储在名为flash的表中的数据库中获取值?

0 个答案:

没有答案