Php 要在数据库as3中插入计时器类时间吗
我想在我的数据库中插入计时器时间。我创建了一个计时器类,该类以分钟和秒为单位递增(在动态文本字段中)。我有一个主页按钮,我希望当我单击主页按钮时,计时器时间将插入到scoreu表的时间列中。所有代码工作正常。列正在更新,但时间未显示在数据库表中。请帮助我解决此问题。这是我的as3代码Php 要在数据库as3中插入计时器类时间吗,php,actionscript-3,Php,Actionscript 3,我想在我的数据库中插入计时器时间。我创建了一个计时器类,该类以分钟和秒为单位递增(在动态文本字段中)。我有一个主页按钮,我希望当我单击主页按钮时,计时器时间将插入到scoreu表的时间列中。所有代码工作正常。列正在更新,但时间未显示在数据库表中。请帮助我解决此问题。这是我的as3代码 var myCount:Number = 00; var seconds:Number = 00; var minutes:Number = 0; var myTime:Timer = new Timer(1000
var myCount:Number = 00;
var seconds:Number = 00;
var minutes:Number = 0;
var myTime:Timer = new Timer(1000,myCount);
myTime.addEventListener(TimerEvent.TIMER, startCount);
my_time.text = "";
myTime.start();
function startCount(event:TimerEvent):void
{
seconds +=1;
if (seconds > 60)
{
seconds =00;
minutes +=1;
}
my_time.text = minutes+":"+(seconds >= 10 ? seconds : "0"+seconds);
}
var variables:URLVariables = new URLVariables();
variables.time1 = my_time.text;
home_Btn.buttonMode = true;
home_Btn.addEventListener(MouseEvent.CLICK, indexBtn_click1);
function indexBtn_click1(event:MouseEvent):void
{
myTime.stop();
var request:URLRequest = new URLRequest('http://localhost/timesend.php');
request.method = URLRequestMethod.POST;
request.data = variables;
var loader:URLLoader = new URLLoader(request);
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(request);
loader.addEventListener(Event.COMPLETE, dataOnLoad);
}
function dataOnLoad(event:Event)
{
var variables:URLVariables = URLVariables(event.target.data);
trace(variables.result); // gives : System Updated
}
这里是timesend.php
<?php
// data.php
include('connect1.php');
// if we are here, that's mean that we are already connected to mysql server
// and we don't need to do another connection
$etime = $_POST['time1'];
// $link is the same connection created in your connect.php script
if (mysqli_query($link, "INSERT INTO scoreu (user) VALUES('$etime')")) {
echo 'result=System Updated';
} else {
echo 'result=error';
}
mysqli_close($link);
表字段类型声明中出现问题..我将其声明为varchar..但现在我已将该类型修复为TEXT..现在它工作正常