SA-MP Forums Archive
MYSQL save problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MYSQL save problem (/showthread.php?tid=581573)



MYSQL save problem - lulo356 - 14.07.2015

PHP код:
savePlayer(playerid)
{
    if(
sInfo[playerid][logged]==0)return 1;
    
//Speichern level,money
    
new query[128];
    
format(query,sizeof(query),"UPDATE user SET level='%i',money='%i',adminlevel='%i', admincode='%i' WHERE id='%i'",sInfo[playerid][level],GetPlayerMoney(playerid),sInfo[playerid][Adminlevel],sInfo[playerid][AdminCode], sInfo[playerid][id]);
    
mysql_function_query(dbhandle,query,false,"","");
    return 
1;

It's not saving the player stats


Re: MYSQL save problem - shadowdog - 14.07.2015

PHP код:
savePlayer(playerid

    if(
sInfo[playerid][logged]==0)return 1
    
//Speichern level,money 
    
new query[128]; 
    
format(query,sizeof(query),"UPDATE `user` SET level='%i',money='%i',adminlevel='%i', admincode='%i' WHERE id='%i'",sInfo[playerid][level],GetPlayerMoney(playerid),sInfo[playerid][Adminlevel],sInfo[playerid][AdminCode], sInfo[playerid][id]); // add ` marks around your user.
    
mysql_function_query(dbhandle,query,false,"",""); 
    return 
1




Re: MYSQL save problem - lulo356 - 14.07.2015

Quote:
Originally Posted by shadowdog
Посмотреть сообщение
PHP код:
savePlayer(playerid

    if(
sInfo[playerid][logged]==0)return 1
    
//Speichern level,money 
    
new query[128]; 
    
format(query,sizeof(query),"UPDATE `user` SET level='%i',money='%i',adminlevel='%i', admincode='%i' WHERE id='%i'",sInfo[playerid][level],GetPlayerMoney(playerid),sInfo[playerid][Adminlevel],sInfo[playerid][AdminCode], sInfo[playerid][id]); // add ` marks around your user.
    
mysql_function_query(dbhandle,query,false,"",""); 
    return 
1

Well, It's still doesn't save (( kan je me PMen misschien kan ik nog meer vaagjes stellen))


Re: MYSQL save problem - Sawalha - 14.07.2015

check your mysql_log.txt file and post the log here


Re: MYSQL save problem - lulo356 - 14.07.2015

Quote:
Originally Posted by Sawalha
Посмотреть сообщение
check your mysql_log.txt file and post the log here
The logs doens't show it, only from last week


Re: MYSQL save problem - Stanford - 14.07.2015

Are you sure that you have created the database properly? (Make sure you have proper variable types);
Moreover, check your loading and when you actually load?


Re: MYSQL save problem - lulo356 - 14.07.2015

bumb


Re: MYSQL save problem - X337 - 14.07.2015

`level` table is MySQL reserved keyword :
https://dev.mysql.com/doc/refman/5.0/en/keywords.html
U need to escape level to `level`
PHP код:
UPDATE user SET `level`='%i',`money`='%i',`adminlevel`='%i', `admincode`='%i' WHERE id='%i'