MySql Not Posting data -
akib - 26.02.2018
MySql not uploading any data to database.
Here is the full code :
PHP код:
if(dialogid == DIALOG_PRICE)
{
if(response)
{
new Float:tmp_x,Float:tmp_y,Float:tmp_z;
GetPlayerPos(playerid,tmp_x,tmp_y,tmp_z);
new id;
id = GetFreeBizID();
bInfo[id][b_selling] = 1;
bInfo[id][b_price] = strval(inputtext);
bInfo[id][b_x] = tmp_x;
bInfo[id][b_y] = tmp_y;
bInfo[id][b_z] = tmp_z;
new query[512];
format(query, sizeof(query),"INSERT INTO biz (b_x, b_y, b_z, b_intx, b_inty, b_intz, b_price, h_selling) VALUES ('%f', '%f', '%f', '%f', '%f', '%f', '%i', '1')",bInfo[b_x],bInfo[b_y],bInfo[b_z],bInfo[b_intx],bInfo[b_inty],bInfo[b_intz],bInfo[b_price],bInfo[b_selling]);
mysql_function_query(dbhandle, query, true, "OnBizCreated", "i", id);
UpdateBiz(id);
}
return 1;
}
Everything working fine, it also show, but it's temporary. Not saving in database
Re: MySql Not Posting data -
Eric_White - 26.02.2018
Do you have a MySQL database already?
Re: MySql Not Posting data -
akib - 26.02.2018
yes. Everything fine, just not posting data's on the fields
Re: MySql Not Posting data -
Eric_White - 26.02.2018
Is this the NGG Script? and if so have you edited the mysql.pwn and OnDialogResponce.pwn
Re: MySql Not Posting data -
akib - 26.02.2018
Quote:
Originally Posted by Eric_White
Is this the NGG Script?
|
nope i am own coding...
Re: MySql Not Posting data -
Eric_White - 26.02.2018
This is an example of the OnDialogResponce
PHP код:
if(dialogid == DIALOG_PURCHASEVIP)
{
if(response)
{
if(PlayerInfo[playerid][pCredits] < GetPVarInt(playerid, "VIPPrice"))
return SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough credits to purchase this item. Visit shop.origin-gaming.net to purchase credits.");
if(PlayerInfo[playerid][pDonateRank] != 0)
return SendClientMessageEx(playerid, COLOR_GREY, "You already have VIP, please wait for it to expire.");
if(GetPVarType(playerid, "VIPType") != 1)
return SendClientMessageEx(playerid, COLOR_GREY, "An error has occured, please try again.");
PlayerInfo[playerid][pDonateRank] = GetPVarInt(playerid, "VIPType");
PlayerInfo[playerid][pTempVIP] = 0;
PlayerInfo[playerid][pBuddyInvited] = 0;
PlayerInfo[playerid][pVIPSellable] = 0;
if(PlayerInfo[playerid][pVIPM] == 0)
{
PlayerInfo[playerid][pVIPM] = VIPM;
VIPM++;
}
if(GetPVarType(playerid, "VIPMonths"))
{
PlayerInfo[playerid][pVIPExpire] = (2592000*GetPVarInt(playerid, "VIPMonths"))+gettime();
}
else
{
PlayerInfo[playerid][pVIPExpire] = 2592000+gettime();
}
GivePlayerCredits(playerid, -GetPVarInt(playerid, "VIPPrice"), 1);
if(GetPVarInt(playerid, "VIPType") == 3)
PlayerInfo[playerid][pGVip] = 1;
new VIPType[7];
new szQuery[128];
if(GetPVarType(playerid, "GoldRenewal"))
{
AmountSold[1]++;
AmountMade[1] += GetPVarInt(playerid, "VIPPrice");
VIPType = "Gold";
//ShopItems[1][sMade] += GetPVarInt(playerid, "VIPPrice");
format(szQuery, sizeof(szQuery), "UPDATE `sales` SET `TotalSold1` = '%d', `AmountMade1` = '%d' WHERE `Month` > NOW() - INTERVAL 1 MONTH", AmountSold[1], AmountMade[1]);
DeletePVar(playerid, "GoldRenewal");
}
else
{
switch(GetPVarInt(playerid, "VIPType")) {
case 1:
{
VIPType = "Bronze";
AmountSold[3]++;
AmountMade[3] += GetPVarInt(playerid, "VIPPrice");
//ShopItems[3][sSold]++;
//ShopItems[3][sMade] += GetPVarInt(playerid, "VIPPrice");
format(szQuery, sizeof(szQuery), "UPDATE `sales` SET `TotalSold3` = '%d', `AmountMade3` = '%d' WHERE `Month` > NOW() - INTERVAL 1 MONTH", AmountSold[3], AmountMade[3]);
}
case 2:
{
VIPType = "Silver";
AmountSold[2]++;
AmountMade[2] += GetPVarInt(playerid, "VIPPrice");
//ShopItems[2][sSold]++;
//ShopItems[2][sMade] += GetPVarInt(playerid, "VIPPrice");
format(szQuery, sizeof(szQuery), "UPDATE `sales` SET `TotalSold2` = '%d', `AmountMade2` = '%d' WHERE `Month` > NOW() - INTERVAL 1 MONTH", AmountSold[2], AmountMade[2]);
}
case 3:
{
VIPType = "Gold";
AmountSold[0]++;
AmountMade[0] += GetPVarInt(playerid, "VIPPrice");
//ShopItems[0][sSold]++;
//ShopItems[0][sMade] += GetPVarInt(playerid, "VIPPrice");
format(szQuery, sizeof(szQuery), "UPDATE `sales` SET `TotalSold0` = '%d', `AmountMade0` = '%d' WHERE `Month` > NOW() - INTERVAL 1 MONTH", AmountSold[0], AmountMade[0]);
}
}
}
mysql_function_query(MainPipeline, szQuery, false, "OnQueryFinish", "i", SENDDATA_THREAD);
format(string, sizeof(string), "You have purchased %s VIP (%d Month(s)) for %s credits.", VIPType,GetPVarInt(playerid, "VIPMonths"), number_format(GetPVarInt(playerid, "VIPPrice")));
SendClientMessageEx(playerid, COLOR_CYAN, string);
format(string, sizeof(string), "[VIP %i] [User: %s(%i)] [IP: %s] [Credits: %s] [VIP: %s(%d)] [Price: %s]", PlayerInfo[playerid][pVIPM], GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerIpEx(playerid), number_format(PlayerInfo[playerid][pCredits]), VIPType,GetPVarInt(playerid, "VIPMonths"), number_format(GetPVarInt(playerid, "VIPPrice")));
Log("logs/credits.log", string), Log("logs/setvip.log", string), print(string);
}
DeletePVar(playerid, "VIPPrice");
DeletePVar(playerid, "VIPMonths");
DeletePVar(playerid, "VIPType");
}
for one of the dialogs. Which links up to a mysql.pwn and uploads content into the mysql server. Can you post screenshots please.