if(mysql_ping() == 1)
This function was descontinued, cause there is no use to it anymore.
The MySQL connection will be always alive until you use mysql_close, or exit your gamemode. |
stock ConnectToDatabase()
{
gSQL = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS);
printf("Connecting to the Local Database...");
if(mysql_ping(gSQL) == 1)
{
//printf("Successfully connected to the MySQL server");
printf("Successfully connected to MySQL server | %s", MYSQL_HOST);
}
else
{
//gSQL = mysql_connect(MYSQL_HOST_HOST, MYSQL_USER_HOST, MYSQL_DB_HOST, MYSQL_PASS_HOST);
//printf("Connecting to the Hosted Database...");
printf("Cannot connect to MySQL Server | %s aborting...", MYSQL_HOST);
//SendRconCommand("exit");
}
return 1;
}
mysql_errno(connectionHandle)
C:\Users\BRANDON\Desktop\CnR Server 0.3z\pawno\include\acnr_account.inc(3683) : error 017: undefined symbol "mysql_num_rows" C:\Users\BRANDON\Desktop\CnR Server 0.3z\pawno\include\acnr_account.inc(3692) : error 017: undefined symbol "mysql_free_result" C:\Users\BRANDON\Desktop\CnR Server 0.3z\pawno\include\acnr_account.inc(3696) : error 017: undefined symbol "mysql_store_result"
and what about:
Код:
C:\Users\BRANDON\Desktop\CnR Server 0.3z\pawno\include\acnr_account.inc(3683) : error 017: undefined symbol "mysql_num_rows" C:\Users\BRANDON\Desktop\CnR Server 0.3z\pawno\include\acnr_account.inc(3692) : error 017: undefined symbol "mysql_free_result" C:\Users\BRANDON\Desktop\CnR Server 0.3z\pawno\include\acnr_account.inc(3696) : error 017: undefined symbol "mysql_store_result" |
Old function of mysql was unsupported since R8+, I suggest you to use threading queries and caches, Its more easiest, here is the tutorial https://sampforum.blast.hk/showthread.php?tid=337810
|
mysql_query(globalstring, _THREAD_SAVE_PLAYER, 0, gSQL);//query
I already used threaded queries like:
Код:
mysql_query(globalstring, _THREAD_SAVE_PLAYER, 0, gSQL);//query |
I mean, cache function, check it out: https://sampforum.blast.hk/showthread.php?tid=337810
|
mysql_store_result();
if(mysql_num_rows(gSQL) > 0)
{
mysql_fetch_row_format(resultline);
if(sscanf(resultline, "p<|>dddddddddddddddddddddddddddd",
PlayerInfo[extraid][pWeapon1],
PlayerInfo[extraid][pWeapon1Ammo],
PlayerInfo[extraid][pWeapon2],
PlayerInfo[extraid][pWeapon2Ammo],
PlayerInfo[extraid][pWeapon3],
PlayerInfo[extraid][pWeapon3Ammo],
PlayerInfo[extraid][pWeapon4],
PlayerInfo[extraid][pWeapon4Ammo],
PlayerInfo[extraid][pWeapon5],
PlayerInfo[extraid][pWeapon5Ammo],
PlayerInfo[extraid][pWeapon6],
PlayerInfo[extraid][pWeapon6Ammo],
PlayerInfo[extraid][pWeapon7],
PlayerInfo[extraid][pWeapon7Ammo],
PlayerInfo[extraid][pWeapon8],
PlayerInfo[extraid][pWeapon8Ammo],
PlayerInfo[extraid][pWeapon9],
PlayerInfo[extraid][pWeapon9Ammo],
PlayerInfo[extraid][pWeapon10],
PlayerInfo[extraid][pWeapon10Ammo],
PlayerInfo[extraid][pWeapon11],
PlayerInfo[extraid][pWeapon11Ammo],
PlayerInfo[extraid][pWeapon12],
PlayerInfo[extraid][pWeapon12Ammo],
PlayerInfo[extraid][pCarSlots],
PlayerInfo[extraid][pBoatSlots],
PlayerInfo[extraid][pHeliSlots],
PlayerInfo[extraid][pPlaneSlots]))
{
//SendClientMessage(extraid, LIGHT_GREEN, "There was a problem while loading your account");
//KickEx(extraid);
mysql_free_result();
return 1;
}
}
mysql_free_result();