Update Database with Adobe Flash - php

I have trouble to edit data in my database (MySQL).
I try to edit data with Flash (.swf)
Here is the flow of my program
Data -> Edit data with flash -> Data updated
My PHP script
<?php
mysql_pconnect ("localhost", "root", "");
mysql_select_db ("adaptasi");
$qResult = mysql_query ('UPDATE materi
SET isi = "????"
WHERE id = 1');
$rString ="";
echo "edit=".$rString;
?>
and my Actionscript for flash
var result:LoadVars = new LoadVars();
var edit:LoadVars = new LoadVars();
var filepath:String;
result.onLoad = function(success:Boolean) {
if (success) {
text_morfologi.text = result.result;
trace("success");
} else {
trace('error...');
}
};
filepath = "http://localhost/adaptasi/";
result.sendAndLoad(filepath + "morfologi.php", result, "GET");
btnedit.setStyle("fontSize", 22);
btnsave.setStyle("fontSize", 22);
btnedit.visible = true;
btnedit.onRelease = function() {
text_morfologi.type = "input";
btnedit.visible = false;
btnsave.visible = true;
}
btnsave.onRelease = function() {
edit.onLoad = function(success:Boolean){
if (success) {
text_morfologi.text = edit.edit;
trace("success");
} else {
trace('error...');
}
};
filepath = "http://localhost/adaptasi/";
edit.sendAndLoad(filepath + "editmorfologi.php", edit, "GET");
btnedit.visible = true;
btnsave.visible = false;
output.text = "data berhasil diubah...";
}
I can execute that script from flash. But I don't know what should I insert into SET in SQL Update...

Related

Web page message [object object]

I'm using a framework called Ispinia to do a simple system for my Company, and when I try to submit anyting give this error:
Web page message [object object].
I'm using IE11.
Thanks in advance!
CODE: Controller.js
function vila_do_conde_ctrl($scope, $http, SweetAlert){
$scope.dataInicio = new Date();
$scope.dataFim = new Date();
$scope.teste = function(){
alert($scope.myDate);
}
$scope.preencheEmbarques = function(){
$http.get("http://127.0.0.1/DIARIODEBORDO/php/preenche_embarques.php?oi="+$scope.oi)
.then(function (response) {$scope.embarques=response.data.records;$scope.emb = ""; $scope.dataChegada = ""; $scope.dataSaida = ""; $scope.dataDesova = ""; $scope.tipoCarga = ""; if($scope.ctn) $scope.ctn = ""; $scope.fornecedor = ""; $scope.servicoAdd = ""; $scope.qte = ""; $scope.unidade = ""; $scope.dataInicio = ""; $scope.dataFim = ""; $scope.obs = ""; $scope.servicos = ""; }, function (response){alert(response);});
};
$scope.buscaServicos = function(){
var embarque = encodeURIComponent($scope.emb.trim());
$http.get("http://127.0.0.1/DIARIODEBORDO/php/preenche_servicos.php?emb="+embarque)
.then(function (response) {
$scope.servicos=response.data.records;
for(var i=0; i<$scope.servicos.length; i++){
var dataAux = $scope.servicos[i].DataInicio.split("-");
$scope.servicos[i].DataInicio = dataAux[2]+"/"+dataAux[1]+"/"+dataAux[0];
dataAux = $scope.servicos[i].DataFim.split("-");
$scope.servicos[i].DataFim = dataAux[2]+"/"+dataAux[1]+"/"+dataAux[0];
}
}, function (response){alert(response);});
};
$scope.preencheDados = function(){
if($scope.emb){
var embarque = encodeURIComponent($scope.emb.trim());
$http.get("http://127.0.0.1/DIARIODEBORDO/php/preenche_dados.php?emb="+embarque)
.then(function (response) {
$scope.dados=response.data.records[0];
if($scope.dados.DtChegada){
$scope.dataAux=$scope.dados.DtChegada.split("-");
$scope.dataChegada=$scope.dataAux[2]+"/"+$scope.dataAux[1]+"/"+$scope.dataAux[0];
}
if($scope.dados.DtSaida){
$scope.dataAux=$scope.dados.DtSaida.split("-");
$scope.dataSaida=$scope.dataAux[2]+"/"+$scope.dataAux[1]+"/"+$scope.dataAux[0];
}
if($scope.dados.DtDesova){
$scope.dataAux=$scope.dados.DtDesova.split("-");
$scope.dataDesova=$scope.dataAux[2]+"/"+$scope.dataAux[1]+"/"+$scope.dataAux[0];
}
$scope.tipoCarga=$scope.dados.TipoCarga;
$scope.ctn=$scope.dados.Container;
$scope.buscaServicos();
}, function(response){alert(response);});
}
};
$scope.adicionarServico = function(){
if($scope.oi && $scope.emb && $scope.fornecedor && $scope.servicoAdd && $scope.qte && $scope.unidade && $scope.dataInicio && $scope.dataFim){
var embarque = encodeURIComponent($scope.emb.trim());
var fornecedor = encodeURIComponent($scope.fornecedor.trim());
var servico = encodeURIComponent($scope.servicoAdd.trim());
var quantidade = encodeURIComponent($scope.qte);
var unidade = encodeURIComponent($scope.unidade.trim());
var data_inicio = encodeURIComponent($scope.dataInicio.getFullYear()+"-"+ ($scope.dataInicio.getMonth() + 1) +"-"+$scope.dataInicio.getDate());
var data_fim = encodeURIComponent($scope.dataFim.getFullYear()+"-"+ ($scope.dataFim.getMonth() + 1) +"-"+$scope.dataFim.getDate());
var obs = "";
if($scope.obs)
obs = encodeURIComponent($scope.obs);
var container = ""
if($scope.tipoCarga){
if($scope.ctn)
container = encodeURIComponent($scope.ctn);
$http.get("http://127.0.0.1/DIARIODEBORDO/php/adicionar_tipo_carga.php?oi="+$scope.oi+"&emb="+embarque+"&ctn="+container)
.then(function (response) {}, function (response){alert(response);});
}
$http.get("http://127.0.0.1/DIARIODEBORDO/php/adicionar_servico.php?oi="+$scope.oi+"&emb="+embarque+"&forn="+fornecedor+"&servico="+servico+"&qte="+quantidade+"&unidade="+unidade+"&dtInicio="+data_inicio+"&dtFim="+data_fim+"&obs="+obs)
.then(function (response) {
SweetAlert.swal({
title: "Serviço adicionado!",
//text: "You clicked the button!",
type: "success"
});
$scope.buscaServicos();}, function (response){alert(response);});
}
else
alert("Preencha todos os campos!");
};
MODEL:
<?php
$oi = $_GET['oi'];
$emb = $_GET['emb'];
$fornecedor = $_GET['forn'];
$servico = $_GET['servico'];
$quantidade = $_GET['qte'];
$unidade = $_GET['unidade'];
$data_inicio = $_GET['dtInicio'];
$data_fim = $_GET['dtFim'];
$obs = $_GET['obs'];
// Create connection
$conn = new mysqli($host, $usuario, $senha, $base_de_Dados);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if ($obs != "")
$sql = "INSERT INTO diario_bordo.servicos (OI, EMBARQUE, FORN_SERVICO, SERVICO, QUANTIDADE, UNIDADE, DATA_INICIO, DATA_FIM, OBSERVACOES) VALUES ('".$oi."','".$emb."','".$fornecedor."','".$servico."',".$quantidade.",'".$unidade."','".$data_inicio."','".$data_fim."','".$obs."')";
else
$sql = "INSERT INTO diario_bordo.servicos (OI, EMBARQUE, FORN_SERVICO, SERVICO, QUANTIDADE, UNIDADE, DATA_INICIO, DATA_FIM) VALUES ('".$oi."','".$emb."','".$fornecedor."','".$servico."',".$quantidade.",'".$unidade."','".$data_inicio."','".$data_fim."')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
[object Object] is the way JavaScript outputs an object. Not sure what the purpose of your script is, but you can show the sub-object by using objectname.key.
e.g. if 'person' is an object containing name and mail address, you can access the sub-objects (probably strings in this example) by calling person.name and person.mailaddress.
I think you should now go through your code again and have a look at all alert messages.

retieve data from database using as3

I had created a database "new" using xampp localhost database had 2 tables user and score. I had an AS3 code which had 2 input textfield to insert user and score value into database tables.
Now I am trying to retrieve the inserted scores from database using user name. I have taken another text field to take user name and a button when I write "sarah" and click button it will return the score of sarah which is already inserted in database. But code is showing an error. I tried a lot but can not fix it.please help.here is my code
AS3 code:
btn2.addEventListener(MouseEvent.MOUSE_DOWN, fetchscore);
function fetchscore(event:MouseEvent)
{
var phpVars:URLVariables = new URLVariables();
var phpFileRequest:URLRequest = new URLRequest('http://localhost/collectscore.php');
phpFileRequest.method = URLRequestMethod.POST;
var phpLoader:URLLoader = new URLLoader();
phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
phpLoader.addEventListener(Event.COMPLETE, showResult);
phpVars.systemCall = "processLogin";
phpVars.cname = Name.text;
phpLoader.load(phpFileRequest);
}
function showResult(e:Event)
{
//trace(phpVars.result);
result_text.text = "" + e.target.data.systemResult;
}
fetchscore.php
<?php
include('connect.php');
$username = $_POST['cname'];
if ($_POST['systemCall'] == "processLogin"){
$sqlqry = "SELECT * FROM scoreu WHERE username='$username'";//scoreu is my DBtable with two field user and score
$query = mysqli_query($sqlqry);
$login_counter = mysqli_num_rows($query);
if ($login_counter > 0) {
while ($data = mysqli_fetch_array($query)) {
if (mysqli_query($link), "SELECT score FROM scoreu WHERE user='$username'")) {
$findscore = $data['score'];
print 'result=$findscore';
}
}
} else {
print 'result=The login details dont match names.';
}
}
?>
connect.php
<?php
// connect.php
$db_name = 'new';
$db_username = 'root';
$db_password = '';
$db_host = 'localhost';
$link = mysqli_connect($db_host, $db_username, $db_password, $db_name);
if (mysqli_connect_errno()) {
die('Failed to connect to the server : '.mysqli_connect_error());
}
?>
You have some "problems" in your code, lets start by the PHP code.
PHP code :
<?php
// collectscore.php
include('connect.php');
$username = $_POST['cname'];
if ($_POST['systemCall'] == "processLogin"){
// you need only one request to get the score
$query = mysqli_query($link, "SELECT score FROM scoreu WHERE user = '$username'");
// you have to fetch the result into a php var
if ($data = mysqli_fetch_assoc($query)) {
$findscore = $data['score'];
// you should use double quotes when passing vars into a string
// otherwise, if you want use single quotes, you can write it : print 'result='.$findscore;
print "result=$findscore";
} else {
print 'result=The login details dont match names.';
}
}
?>
ActionScript code :
function fetchscore(event:MouseEvent): void
{
var phpVars:URLVariables = new URLVariables();
phpVars.systemCall = "processLogin";
phpVars.cname = cname.text; // name text field
var phpFileRequest:URLRequest = new URLRequest('http://127.0.0.1/collectscore.php');
phpFileRequest.method = URLRequestMethod.POST;
// you forgot to send your POST vars, for that, we use URLRequest.data
phpFileRequest.data = phpVars;
var phpLoader:URLLoader = new URLLoader();
phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
phpLoader.addEventListener(Event.COMPLETE, showResult);
phpLoader.load(phpFileRequest);
}
function showResult(e:Event):void
{
// here the var should be the same as in the PHP script, result in this case : print "result=$findscore";
trace(e.target.data.result);
}
Hope that can help.

connect as3 to mysql not work

I tried to link my actionscript3 application to the database ... Here are my codes.
MY AS3 CODE:
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.net.URLRequestMethod;
const SENT_SUCCESS:String = "Successful";
const SENT_FAILED:String = "Unsuccessful";
var tmr:Timer;
function resetTextFields():void {
username.text = String("username");
password.text = String("password");
}
function afterTmrWait(evt:TimerEvent):void {
tmr.stop();
tmr.removeEventListener(TimerEvent.TIMER, afterTmrWait);
}
function submitForm(evt:MouseEvent):void {
var passChecks:Boolean = true;
if(username.text == String("")) {
passChecks = false;<br>
}
if(password.text == String("")) <br>{<br>
passChecks = false;
}
if(passChecks) {
var urlVars:URLVariables = new URLVariables();
var urlReq:URLRequest = new URLRequest("php/login.php");
var ldr:URLLoader = new URLLoader();
urlVars.username = username.text;
urlVars.password = password.text;
urlReq.data = urlVars;
urlReq.method = URLRequestMethod.POST;
ldr.addEventListener(Event.COMPLETE, serverFeedback);
ldr.load(urlReq);
ldr.dataFormat = URLLoaderDataFormat.VARIABLES;
}
}
function serverFeedback(evt:Event):void {
var ldr:URLLoader = evt.target as URLLoader;
var urlVars:URLVariables = new URLVariables(ldr.data);
if(urlVars.result == SENT_SUCCESS) {
login_result.gotoAndStop(2);
resetTextFields();
} else if(urlVars.result == SENT_FAILED) {
login_result.gotoAndStop(3);
}
tmr = new Timer(3000, 1);
tmr.addEventListener(TimerEvent.TIMER, afterTmrWait);
tmr.start();
}
login_btn.addEventListener(MouseEvent.CLICK, submitForm);
resetTextFields();
MY PHP CODE:
<?php
$username = $_POST['username'];
$password = $_POST['password'];
if(exist($_POST['username']) && exist($_POST['password'])) {
$mysql = mysql_connect("host", "username", "password", "database");
$password = md5(stripslashes($mysql->real_escape_string($password)));
$outcome = $mysql->query("SELECT * FROM user WHERE username='{$username}' AND password='{$password}' LIMIT 1");
if(!$outcome->null_rows) {
echo( "result=Unsuccessful" );
} else {
echo( "result=Successful" );
}
}
?>
AND I GET THIS ERROR IN FLASH:
Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
at Error$/throwError()
at flash.net::URLVariables/decode()
at flash.net::URLVariables()
at flash.net::URLLoader/onComplete()
PLEASE HELP ME, WHAT I DO WRONG?
The URLLoader dataFormat by default is text. You need to add
ldr.dataFormat=URLLoaderDataFormat.VARIABLES;
so it does throw an error when you try
var urlVars:URLVariables = new URLVariables(ldr.data);
set dataFormat before load request..
your code
ldr.load(urlReq);
ldr.dataFormat = URLLoaderDataFormat.VARIABLES;
try this....
ldr.dataFormat = URLLoaderDataFormat.VARIABLES;
ldr.load(urlReq);

as3 and php variables issue

I have a MySQL database and I access it through PHP script. The issue I have is that the variables returned from PHP are always the same.
First time I run the code (add/remove records in the database) every thing is correct, but if I'm running it again (add/remove) PHP reports back to AS3 the same records as before. running the php directly in the browser returns are correct.
hope someone can help me... I'm getting crazy!
here are my codes:
AS3
function sendSqlData(event:Event):void
{
playlistDateString = "&playlistDateString="+playlistDate.getFullYear().toString()+monthDigit+playlistDate.getMonth().toString()+dayDigit+playlistDate.getDate().toString();
playlistSongNr = "&playlistSongNr="+ song;
songTime ="&songTime="+ Math.floor(channel.position);
var phpUrl:String = "send_data.php";
var phpUrlRequest:URLRequest = new URLRequest(phpUrl+parseMe+playlistDateString+playlistSongNr+songTime);
scriptLoader = new URLLoader();
scriptLoader.addEventListener(Event.COMPLETE, sendSqlDataComplete);
scriptLoader.load(phpUrlRequest);
}
function getSqlData(event:Event):void
{
var phpUrl:String = "get_data.php";
var phpUrlRequest:URLRequest = new URLRequest(phpUrl+parseMe);
// phpUrlRequest.method = URLRequestMethod.POST;
scriptLoader = new URLLoader();
// scriptLoader.dataFormat = URLLoaderDataFormat.TEXT;
scriptLoader.addEventListener(Event.COMPLETE, getSqlDataComplete);
scriptLoader.load(phpUrlRequest);
}
function sendSqlDataComplete(event:Event):void
{
scriptLoader.removeEventListener(Event.COMPLETE, sendSqlDataComplete);
var phpVars:URLVariables = new URLVariables();
phpVars.decode(event.target.data);
getSqlData(event);
}
function getSqlDataComplete(event:Event):void
{
scriptLoader.removeEventListener(Event.COMPLETE, getSqlDataComplete);
var phpVars:URLVariables = new URLVariables();
phpVars.decode(event.target.data);
var phpString = event.target.data.toString();
var patterns:Array = ["id\\d{0,5}=\\d{0,5}", "playlistDate\\d{0,5}=\\d{0,8}", "playlistSongNr\\d{0,5}=\\d", "songTime\\d{0,5}=\\d{0,7}"];
for (var j:int = 0; j < 4; j++)
{
var pattern:RegExp = new RegExp(patterns[j],"g");
var tempStrings:Array = phpString.match(pattern);
for (i = 0; i < Number(phpVars.records); i++)
{
switch (j)
{
case 0:
ids[i] = Number(tempStrings[i].substring( tempStrings[i].indexOf("=")+1 ));
break;
case 1:
playlistDates[i] = Number(tempStrings[i].substring( tempStrings[i].indexOf("=")+1 ));
break;
case 2:
playlistSongNrs[i] = Number(tempStrings[i].substring( tempStrings[i].indexOf("=")+1 ));
break;
case 3:
songTimes[i] = Number(tempStrings[i].substring( tempStrings[i].indexOf("=")+1 ));
break;
}
}
tempStrings = null;
}
fillDataGrid(Number(phpVars.records));
}
PHP: send_data.php
<?php
include_once ('connect.php');
$playlistDateString = trim($_GET['playlistDateString']);
$playlistSongNr = trim($_GET['playlistSongNr']);
$songTime = trim($_GET['songTime']);
if($connection)
{
$status .= ("connect=ok&");
//Select database
mysql_select_db($dbname, $connection);
$sql="INSERT INTO $tablename1 (ID, playlistDate, playlistSongNr, songTime, comment) VALUES ('', '$playlistDateString', '$playlistSongNr', '$songTime', 'comment');";
$status .= ("sql=".$sql."&");
// Execute query
if (mysql_query($sql,$connection) )
{
$status .= ("query=ok");
}
else
{
$status .= ("query=error:".mysql_error());
}
}
else
{
$status = ("connect=error: ".mysql_error());
}
echo $status;
mysql_close($connection);
?>
PHP get_data.php
<?php
include_once ('connect.php');
if($connection)
{
$status .= ("connect=ok");
//Select database
mysql_select_db($dbname, $connection);
//Execute query
$query = mysql_query("SELECT * FROM $tablename1");
if ($query)
{
$result = "records=".(mysql_num_rows($query));
$i = 0;
while ($row = mysql_fetch_array($query))
{
$result .= "&id".$i."=".($row["ID"]);
$result .= "&playlistDate".$i."=".($row["playlistDate"]);
$result .= "&playlistSongNr".$i."=".($row["playlistSongNr"]);
$result .= "&songTime".$i."=".($row["songTime"]);
$result .= "&comment".$i."='".($row["comment"])."'";
$i++;
}
$status .= ("&receive=ok");
echo $result."&";
}
else
{
$status .= ("&receive=error");
}
}
else
{
$status .= ("connect=error:".mysql_error());
}
echo $status;
mysql_close($connection);
?>
It seems that your response is being cached when you call it from ActionScript. You can add a microtime value to the end of the URL (which will prevent caching).
var phpUrl:String = "get_data.php?" + new Date().getTime();

Ajax, PHP, MySQL Not updating server or webapge

I am having an issue with my AJAX and MySQL/PHP script.
The first file below, is my javascript file I use to test accessing my server. This file works as far as I know and have tested.
Game = function() {};
var timer;
Game.EncodeURI = function (text) {
return encodeURIComponent(text);
}
Game.DecodeURI = function (text) {
return decodeURIComponent(text);
}
Game.AlterDiv = function(div,data) {
if (Game.ID(div)) {
Game.ID(div).innerHTML = data;
}
}
Game.ID = function(value) {
return document.getElementById(value);
}
Game.ServerRequest = function (url, data) {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest(); // code for IE7+, Firefox, Chrome, Opera, Safari
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // code for IE6, IE5
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
data = xmlhttp.responseText.split("|");
for (i = 0; i < data.length; i++){
var one = Game.DecodeURI(data[parseInt(i)]);
var two = Game.DecodeURI(data[parseInt(i) + 1]);
var three = Game.DecodeURI(data[parseInt(i) + 2]);
var four = Game.DecodeURI(data[parseInt(i) + 3]);
var five = Game.DecodeURI(data[parseInt(i) + 4]);
}
} else {
return false;
}
}
if (!data) {
data = "";
}
data = data.replace(/: /gi, "=");
data = data.replace(/:/gi, "=");
data = data.replace(/, /gi, "&");
data = data.replace(/,/gi, "&");
xmlhttp.open("POST",url,true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send(data);
}
Game.Action = function (id, seconds) {
clearTimeout(timer);
if (id) {
if (!seconds) {
Game.AlterDiv('message', 'You begin working.');
Game.ServerRequest("action.php", "id: " + id);
} else {
Game.AlterDiv('message', 'You begin working.');
Game.ID('timer').innerHTML = seconds;
if (seconds >= 2) {
seconds -= 1;
Game.ID('timer').innerHTML = seconds;
timer = setTimeout(function(){
Game.Action(id, seconds);
},1000);
} else {
Game.ID('timer').innerHTML = "Finished";
Game.ServerRequest("action.php", "id: " + id + ", x: x"); // Request it, then POST "x" to say timer has counted down.
}
}
} else {
alert("There was an error with your request.\n Please try again.");
}
}
This second file is a basic PHP web page that I use to test the said function.
<html>
<head>
<title>Test</title>
</head>
<body>
<span onClick="Game.Action('1','5');">Start Work</span><br /><br />
<div id="message"></div>
<div id="timer"></div>
</body>
</html>
<script type="text/javascript" src="game.js?<?php echo time(); ?>"></script><!-- the time() stops it cache-ing -->
This third file is my PHP/MYSQL file that I use to connect to the database.
<?php
$mysqli = new mysqli_connect("127.0.0.1", "root", "", "gurstang");
$id = $_POST['id'];
if(isset($_POST['x'])) {
$x = true;
}else{
$x = false;
}
$userid = 1;
$query = "SELECT * FROM `action_info` WHERE `actionid` = '$id'";
if($result = $mysqli->query($query)){
while ($row = $result->fetch_assoc()) {
$action_name = $row['name'];
$basetimer = $row['time'];
$gaineditem = $row['itemid'];
}
$result->free();
}
$query = "SELECT `item`,`plural` FROM `items` WHERE `itemid` = '$gaineditem' LIMIT 0,1";
if($result = $mysqli->query($query)){
while($row = $result->fetch_assoc()){
$gained_item = $row['item'];
$gained_plural = $row['plural'];
}
$result->free();
}
if($x == false){
echo "Action|$id|"5"";
$message = "You have begun working.";
echo "AlterDiv|message|$message";
}
if($x == true){
echo "Action|$id|"5"";
$itemnumber = mt_rand(1,2);
$gainedmessage = "You have gained $itemnumner $gained_item.";
echo "AlterDiv|message|$gainedmessage";
$query = "SELECT `count` FROM inventory WHERE userid = '$userid' AND itemid = '$gaineditem' LIMIT 0,1";
if($result = $mysqli->query($query)){
while($row = $result->fetch_assoc()){
$count = $row['count'];
$add = $count + $itemnumber;
$updatequery = "UPDATE `inventory` SET `count` = '$add' WHERE `userid` = '$userid' AND `itemid` = '$gaineditem'";
$mysqli->query($updatequery);
}
}
else{
$insertquery = "INSERT INTO `inventory` (`userid`, `itemid` ,`count`) VALUES ('$userid', '$gaineditem', '1')";
$mysqli->query($insertquery);
}
}
?>
Those are all 3 of the file currently to run my script. I have an onclick event in the php webpage, and it sends the values to my Javascript function of Game.Action. After testing I have concluded or at least assume that my Javascript function for Game.Action works. After testing my Game.ServerRequest function, I have concluded that there is a change somewhere happening. Although, when I check my server to see if the updates actually happened, nothing happens. It doesn't update the timer div or the message div properly.
So basically my question is, is my issue with PHP/MYSQL or AJAX?
Thanks for your help.

Categories