SA-MP Forums Archive
Mysql Error - 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 Error (/showthread.php?tid=574164)



Mysql Error - GatsbyTrieu - 14.05.2015

Hi, im create the Actor System using Mysql Database, everything is ok when im add Animations System.

Server-Log

Quote:

[15:15:48] [MySQL] Query Error - (ErrorID: 1064) (Handle: 1)
[15:15:48] [MySQL] Check mysql_log.txt to review the query that threw the error.
[15:15:48] Dumping query from 2015/5/14 (15:15:4

Description: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' `OwnName`=, `Name`=, `Vw`=0, `Int`=0, `CurentLib`=ATTRACTORS, `CurentAim`=STEPS' at line 1 (index 0). Query:


[15:15:48] UPDATE `actor` SET `acID`=1, `OwnID`=0,`BizID`=0,`PosX`=-2003.606811, `PosY` =329.781555, `PosZ`=35.015621, `PosA`=0.000000, `Model`=1, `Health`=0, `Invu`=0, `GioiThieu`=, `OwnName`=, `Name`=, `Vw`=0, `Int`=0, `CurentLib`=ATTRACTORS, `CurentAim`=STEPSIT_LOOP, `CurentIdx`=0, `Speed`=4.000000, `Loop`=0, `LockX`=0, `LockY`=0, `Freeze`=0, `Time`=0, WHERE `ID`=2

PHP код:
stock SaveActor(id)
{
    new 
string[512];
    
printf("Luu thong tin diem nhan viec ID: %d"id);
    
format(stringsizeof(string), "UPDATE `actor` SET \
        `acID`=%d, \
        `OwnID`=%d,\
        `BizID`=%d,\
        `PosX`=%f, \
        `PosY` =%f, \
        `PosZ`=%f, \
        `PosA`=%f, \
        `Model`=%d, \
        `Health`=%d, \
        `Invu`=%d, \
        `GioiThieu`=%s, \
        `OwnName`=%s, \
        `Name`=%s, \
        `Vw`=%d, \
        `Int`=%d, \
        `CurentLib`=%s, \
        `CurentAim`=%s, \
        `CurentIdx`=%d, \
        `Speed`=%f, \
        `Loop`=%d, \
        `LockX`=%d, \
        `LockY`=%d, \
        `Freeze`=%d, \
        `Time`=%d, \
        WHERE `ID`=%d"
,
          
ACInfo[id][acID],
        
ACInfo[id][acOwnID],
        
ACInfo[id][acBizID],
        
ACInfo[id][acPosX],
        
ACInfo[id][acPosY],
        
ACInfo[id][acPosZ],
        
ACInfo[id][acPosA],
        
ACInfo[id][acModel],
        
ACInfo[id][acHealth],
        
ACInfo[id][acInvu],
        
g_mysql_ReturnEscaped(ACInfo[id][acDes], MainPipeline),
        
g_mysql_ReturnEscaped(ACInfo[id][acOwnName], MainPipeline),
        
g_mysql_ReturnEscaped(ACInfo[id][acName], MainPipeline),
        
ACInfo[id][acVW],
        
ACInfo[id][acInt],
        
g_mysql_ReturnEscaped(ACInfo[id][acCurentLib], MainPipeline),
        
g_mysql_ReturnEscaped(ACInfo[id][acCurentAim], MainPipeline),
        
ACInfo[id][acCurentIdx],
        
ACInfo[id][ac_Speed],
        
ACInfo[id][ac_Loop],
        
ACInfo[id][ac_LockX],
        
ACInfo[id][ac_LockY],
        
ACInfo[id][ac_Freeze],
        
ACInfo[id][ac_Time],
        
id+1
    
); // Array starts from zero, MySQL starts at 1 (this is why we are adding one).
    
mysql_function_query(MainPipelinestringfalse"OnQueryFinish""i"SENDDATA_THREAD);
}
stock g_mysql_ReturnEscaped(unEscapedString[], connectionHandle)
{
    new 
EscapedString[256];
    
mysql_real_escape_string(unEscapedStringEscapedStringconnectionHandle);
    return 
EscapedString;




Re: Mysql Error - GatsbyTrieu - 14.05.2015

Anyone can help me pls ?


Re: Mysql Error - Konstantinos - 14.05.2015

Replace any %s with '%s'.


Re: Mysql Error - GatsbyTrieu - 14.05.2015

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Replace any %s with '%s'.
I also recently realized the problem and fix that success: D. Anyway thank you for the reply.