Mysql Trouble -
DyduShxD - 26.01.2019
Hello, i have changed my mysql version from R39 to R41, but ai just got mistmatch to lots of things and my server wont work.
Code:
(14) : warning 213: tag mismatch
(16) : warning 213: tag mismatch
(49) : warning 213: tag mismatch
(50) : warning 213: tag mismatch
(54) : warning 213: tag mismatch
(55) : warning 213: tag mismatch
(59) : warning 213: tag mismatch
(60) : warning 213: tag mismatch
(64) : warning 213: tag mismatch
(65) : warning 213: tag mismatch
(69) : warning 213: tag mismatch
(70) : warning 213: tag mismatch
(74) : warning 213: tag mismatch
(75) : warning 213: tag mismatch
(79) : warning 213: tag mismatch
(80) : warning 213: tag mismatch
(84) : warning 213: tag mismatch
(85) : warning 213: tag mismatch
(89) : warning 213: tag mismatch
(90) : warning 213: tag mismatch
(94) : warning 213: tag mismatch
(95) : warning 213: tag mismatch
(99) : warning 213: tag mismatch
(100) : warning 213: tag mismatch
(104) : warning 213: tag mismatch
(105) : warning 213: tag mismatch
(109) : warning 213: tag mismatch
(110) : warning 213: tag mismatch
(114) : warning 213: tag mismatch
(115) : warning 213: tag mismatch
(119) : warning 213: tag mismatch
(120) : warning 213: tag mismatch
(124) : warning 213: tag mismatch
(125) : warning 213: tag mismatch
(129) : warning 213: tag mismatch
(130) : warning 213: tag mismatch
(134) : warning 213: tag mismatch
(135) : warning 213: tag mismatch
(139) : warning 213: tag mismatch
(140) : warning 213: tag mismatch
(144) : warning 213: tag mismatch
(145) : warning 213: tag mismatch
(557) : warning 213: tag mismatch
(558) : warning 213: tag mismatch
(756) : warning 213: tag mismatch
(806) : warning 213: tag mismatch
(807) : warning 213: tag mismatch
(826) : warning 213: tag mismatch
(827) : warning 213: tag mismatch
(844) : warning 213: tag mismatch
(959) : warning 213: tag mismatch
(960) : warning 213: tag mismatch
PHP Code:
14 handle = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
16 if(handle && mysql_errno(handle) == 0)
49 to 145 - public Update(playerid, type)
{
if(IsPlayerConnected(playerid))
{
new string[256];
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, sizeof(playerName));
{
switch(type)
{
case pLevelu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `Level`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pLevel], playerName);
mysql_pquery(handle, string);
}
case pAdminu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `AdminLevel`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pAdmin], playerName);
mysql_pquery(handle, string);
}
case pHelperu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `HelperLevel`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pHelper], playerName);
mysql_pquery(handle, string);
}
case pCashu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `Cash`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pCash], playerName);
mysql_pquery(handle, string);
}
case pAccountu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `Account`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pAccount], playerName);
mysql_pquery(handle, string);
}
case pEmailu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `Email`='%e' WHERE `username`='%e'", PlayerInfo[playerid][pEmail], playerName);
mysql_pquery(handle, string);
}
case pRegistredu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `Registred`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pRegistred], playerName);
mysql_pquery(handle, string);
}
case pTutorialu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `Tutorial`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pTutorial], playerName);
mysql_pquery(handle, string);
}
case pSexu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `Sex`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pSex], playerName);
mysql_pquery(handle, string);
}
case pAgeu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `Age`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pAge], playerName);
mysql_pquery(handle, string);
}
case pPhoneNumberu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `PhoneNumber`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pPhoneNumber], playerName);
mysql_pquery(handle, string);
}
case pPremiumAccountu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `PremiumAccount`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pPremiumAccount], playerName);
mysql_pquery(handle, string);
}
case pBannedu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `Banned`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pBanned], playerName);
mysql_pquery(handle, string);
}
case pWarnsu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `Warns`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pWarns], playerName);
mysql_pquery(handle, string);
}
case pLeaderu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `Leader`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pLeader], playerName);
mysql_pquery(handle, string);
}
case pMemberu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `Member`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pMember], playerName);
mysql_pquery(handle, string);
}
case pRanku:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `Rank`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pRank], playerName);
mysql_pquery(handle, string);
}
case pSkinu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `Skin`='%d' WHERE `username`='%e'", PlayerInfo[playerid][pSkin], playerName);
mysql_pquery(handle, string);
}
case pIPu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET IP='%e' WHERE username='%e'", PlayerInfo[playerid][pIP], playerName);
mysql_pquery(handle, string);
}
case pLastLoginu:
{
mysql_format(handle, string, sizeof(string), "UPDATE players SET `LastLogin`= CURRENT_TIMESTAMP WHERE `username`='%e'", playerName);
mysql_pquery(handle, string);
}
}
}
}
}
and most of them mysql_format(handle, query, sizeof(query), "INSERT INTO `players` (`username`,`password`) VALUES ('%e', MD5('%e'))", pName, password);
mysql_tquery(handle, query, "", "");
So i just get warnings for every update im tryingto made...
Re: Mysql Trouble -
Calisthenics - 26.01.2019
Variable `handle` must have
MySQL: tag when being declared.
Re: Mysql Trouble -
DyduShxD - 26.01.2019
WHUT thank you so much buddy. Still have 2 more ..
cache_get_value_index_bool(rows, fields, handle);
cache_get_value_index_bool(rows, fields, handle);
Re: Mysql Trouble -
Calisthenics - 26.01.2019
pawn Code:
native cache_get_value_index_bool(row_idx, column_idx, &bool:destination);
Did you try to convert `cache_get_data` function? It does not exist anymore, so use cache_num_rows() macro or cache_get_row_count(&rows) function.
Re: Mysql Trouble -
DyduShxD - 26.01.2019
Code:
function WhenPlayerLogin(playerid)
{
if(IsPlayerConnected(playerid))
{
new string[256];
new pName[30];
GetPlayerName(playerid, pName, sizeof(pName));
cache_get_value_index(rows, fields, handle);
if(rows != 0)
{
mysql_fetch_field_row(0, "password", temp), format(PlayerInfo[playerid][pPassword], 128, temp);
mysql_fetch_field_row(0, "Level", temp), PlayerInfo[playerid][pLevel] = strval(temp);
mysql_fetch_field_row(0, "AdminLevel", temp), PlayerInfo[playerid][pAdmin] = strval(temp);
mysql_fetch_field_row(0, "HelperLevel", temp), PlayerInfo[playerid][pHelper] = strval(temp);
mysql_fetch_field_row(0, "Cash", temp), PlayerInfo[playerid][pCash] = strval(temp);
mysql_fetch_field_row(0, "Account", temp), PlayerInfo[playerid][pAccount] = strval(temp);
mysql_fetch_field_row(0, "Email", temp), format(PlayerInfo[playerid][pEmail], 256, temp);
mysql_fetch_field_row(0, "Registred", temp), PlayerInfo[playerid][pRegistred] = strval(temp);
mysql_fetch_field_row(0, "Tutorial", temp), PlayerInfo[playerid][pTutorial] = strval(temp);
mysql_fetch_field_row(0, "Sex", temp), PlayerInfo[playerid][pSex] = strval(temp);
mysql_fetch_field_row(0, "Age", temp), PlayerInfo[playerid][pAge] = strval(temp);
mysql_fetch_field_row(0, "PhoneNumber", temp), PlayerInfo[playerid][pPhoneNumber] = strval(temp);
mysql_fetch_field_row(0, "PremiumAccount", temp), PlayerInfo[playerid][pPremiumAccount] = strval(temp);
mysql_fetch_field_row(0, "Banned", temp), PlayerInfo[playerid][pBanned] = strval(temp);
mysql_fetch_field_row(0, "Warns", temp), PlayerInfo[playerid][pWarns] = strval(temp);
mysql_fetch_field_row(0, "Leader", temp), PlayerInfo[playerid][pLeader] = strval(temp);
mysql_fetch_field_row(0, "Member", temp), PlayerInfo[playerid][pMember] = strval(temp);
mysql_fetch_field_row(0, "Rank", temp), PlayerInfo[playerid][pRank] = strval(temp);
mysql_fetch_field_row(0, "Skin", temp), PlayerInfo[playerid][pSkin] = strval(temp);
mysql_fetch_field_row(0, "IP", temp), PlayerInfo[playerid][pIP] = strval(temp);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "The passwords don't match!\nType your account's password below:", "Login", "Exit");
return 1;
}
if(PlayerInfo[playerid][pRegistred] == 0)
{
PlayerInfo[playerid][pLevel] = 1;
Update(playerid, pLevelu);
PlayerInfo[playerid][pAdmin] = 0;
Update(playerid, pAdminu);
GivePlayerCash(playerid, 150);
PlayerInfo[playerid][pAccount] = 500;
Update(playerid, pAccountu);
PlayerInfo[playerid][pRegistred] = 1;
Update(playerid, pRegistredu);
new randomphonenumber = 1000000 + random(9999999);
PlayerInfo[playerid][pPhoneNumber] = randomphonenumber;
Update(playerid, pPhoneNumberu);
PlayerInfo[playerid][pInterior] = 0;
}
if(PlayerInfo[playerid][pBanned] == 1)
{
KickWithMessage(playerid, COLOR_LIGHTRED2, "Your account is currently banned.");
KickWithMessage(playerid, COLOR_LIGHTRED2, "In case you think this is a confusion, request an unban at the forums.");
}
GetPlayerCash(playerid);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
SetPlayerCash(playerid, PlayerInfo[playerid][pCash]);
new rand = random(sizeof(SpawnCivR));
SetSpawnInfo(playerid, 0, 0, SpawnCivR[rand][0],SpawnCivR[rand][1],SpawnCivR[rand][2],SpawnCivR[rand][3], 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
Update(playerid, pLastLoginu);
new pNameIP[256];
GetPlayerIp(playerid, pNameIP, sizeof(pNameIP));
strmid(PlayerInfo[playerid][pIP], pNameIP, 0, 100, 255);
Update(playerid, pIPu);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
format(string, sizeof(string), "You're logged in as a level %d admin.", PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_YELLOW2, string);
}
if (PlayerInfo[playerid][pHelper] >= 1)
{
format(string, sizeof(string), "You're logged in as a level %d helper.", PlayerInfo[playerid][pHelper]);
SendClientMessage(playerid, COLOR_YELLOW2, string);
}
if (PlayerInfo[playerid][pPremiumAccount] >= 1)
{
SendClientMessage(playerid, COLOR_WHITE,"You're a premium account user. ");
}
printf("%s has logged in.", pName);
gLogged[playerid] = 1;
}
return 1;
}
Look here is the problem.. u can see it on top... Sorry but i just want to make this start and that;s it..
Re: Mysql Trouble -
Calisthenics - 26.01.2019
`cache_get_data` used to pass by reference the row count. You can just do:
pawn Code:
if (cache_num_rows())
{
// cache functions to retrieve
}
or
pawn Code:
new rows;
cache_get_row_count(rows);
if (rows)
{
// cache functions to retrieve
}
Do not use `mysql_fetch_field_row` macro or whatever that is and then converting to integet/float using `strval` or `floatstr`. There are `cache_get_value_int` and `cache_get_value_float` functions.
Re: Mysql Trouble -
DyduShxD - 26.01.2019
Still same problem. ive tried.
Code:
public WhenPlayerLogin(playerid)
{
if(IsPlayerConnected(playerid))
{
new string[256];
new pName[30];
GetPlayerName(playerid, pName, sizeof(pName));
cache_get_data(rows, fields, handle);
if(rows != 0)
{
cache_get_field_content(0, "password", temp), format(PlayerInfo[playerid][pPassword], 128, temp);
cache_get_field_content(0, "Level", temp), PlayerInfo[playerid][pLevel] = strval(temp);
cache_get_field_content(0, "AdminLevel", temp), PlayerInfo[playerid][pAdmin] = strval(temp);
cache_get_field_content(0, "HelperLevel", temp), PlayerInfo[playerid][pHelper] = strval(temp);
cache_get_field_content(0, "Cash", temp), PlayerInfo[playerid][pCash] = strval(temp);
cache_get_field_content(0, "Account", temp), PlayerInfo[playerid][pAccount] = strval(temp);
cache_get_field_content(0, "Email", temp), format(PlayerInfo[playerid][pEmail], 256, temp);
cache_get_field_content(0, "Registred", temp), PlayerInfo[playerid][pRegistred] = strval(temp);
cache_get_field_content(0, "Tutorial", temp), PlayerInfo[playerid][pTutorial] = strval(temp);
cache_get_field_content(0, "Sex", temp), PlayerInfo[playerid][pSex] = strval(temp);
cache_get_field_content(0, "Age", temp), PlayerInfo[playerid][pAge] = strval(temp);
cache_get_field_content(0, "PhoneNumber", temp), PlayerInfo[playerid][pPhoneNumber] = strval(temp);
cache_get_field_content(0, "PremiumAccount", temp), PlayerInfo[playerid][pPremiumAccount] = strval(temp);
cache_get_field_content(0, "Banned", temp), PlayerInfo[playerid][pBanned] = strval(temp);
cache_get_field_content(0, "Warns", temp), PlayerInfo[playerid][pWarns] = strval(temp);
cache_get_field_content(0, "Leader", temp), PlayerInfo[playerid][pLeader] = strval(temp);
cache_get_field_content(0, "Member", temp), PlayerInfo[playerid][pMember] = strval(temp);
cache_get_field_content(0, "Rank", temp), PlayerInfo[playerid][pRank] = strval(temp);
cache_get_field_content(0, "Skin", temp), PlayerInfo[playerid][pSkin] = strval(temp);
cache_get_field_content(0, "IP", temp), PlayerInfo[playerid][pIP] = strval(temp);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "The passwords don't match!\nType your account's password below:", "Login", "Exit");
return 1;
}
if(PlayerInfo[playerid][pRegistred] == 0)
{
PlayerInfo[playerid][pLevel] = 1;
Update(playerid, pLevelu);
PlayerInfo[playerid][pAdmin] = 0;
Update(playerid, pAdminu);
GivePlayerCash(playerid, 150);
PlayerInfo[playerid][pAccount] = 500;
Update(playerid, pAccountu);
PlayerInfo[playerid][pRegistred] = 1;
Update(playerid, pRegistredu);
new randomphonenumber = 1000000 + random(9999999);
PlayerInfo[playerid][pPhoneNumber] = randomphonenumber;
Update(playerid, pPhoneNumberu);
PlayerInfo[playerid][pInterior] = 0;
}
if(PlayerInfo[playerid][pBanned] == 1)
{
KickWithMessage(playerid, COLOR_LIGHTRED2, "Your account is currently banned.");
KickWithMessage(playerid, COLOR_LIGHTRED2, "In case you think this is a confusion, request an unban at the forums.");
}
GetPlayerCash(playerid);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
SetPlayerCash(playerid, PlayerInfo[playerid][pCash]);
SetSpawnInfo(playerid, 0, 0, 1742.9515, -1862.3721, 13.5764, 359.5591, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
Update(playerid, pLastLoginu);
new pNameIP[256];
GetPlayerIp(playerid, pNameIP, sizeof(pNameIP));
strmid(PlayerInfo[playerid][pIP], pNameIP, 0, 100, 255);
Update(playerid, pIPu);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
format(string, sizeof(string), "You're logged in as a level %d admin.", PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_YELLOW2, string);
}
if (PlayerInfo[playerid][pHelper] >= 1)
{
format(string, sizeof(string), "You're logged in as a level %d helper.", PlayerInfo[playerid][pHelper]);
SendClientMessage(playerid, COLOR_YELLOW2, string);
}
if (PlayerInfo[playerid][pPremiumAccount] >= 1)
{
SendClientMessage(playerid, COLOR_WHITE,"You're a premium account user. ");
}
printf("%s has logged in.", pName);
gLogged[playerid] = 1;
}
return 1;
}
Thhis is right code as it was.
Re: Mysql Trouble -
Kane - 26.01.2019
Where are these 'types' defined at?
You could of simplified it by adding the enumerator tag behind the parameter.
Code:
Update(playerid, PLAYER_INFO_ENUM:type)
Use it as:
Code:
Update(playerid, pRank);
PlayerInfo[playerid][type]
Re: Mysql Trouble -
DyduShxD - 26.01.2019
Problem solved thank you all for your help. seems that appear other thing now my server is run time error when i start it