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



Error Mysql in samp - Parka - 10.02.2013

error

PHP код:
[23:39:55EID1064 ErrorYou have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near ''jugador' ( 'id'    int(12) NOT NULL AUTO_INCREMENT,'nombre' varchar(24) NOT NULL,'' at line 1 | Query: CREATE TABLE IF NOT EXISTS 'jugador' ( 'id'    int(12) NOT NULL AUTO_INCREMENT,'nombre' varchar(24) NOT NULL,'pass'      varchar(129) NOT NULL,'salt'      varchar(30) NOT NULL,'admin'    int(12) NOT NULL,'nivel' int(12) NOT NULL,'experiencia'int(12) NOT NULL,'kills'         int(12) NOT NULL,'deaths'     int(12) NOT NULL,'damages'    int(12) NOT NULL,'skin'       int(12) NOT NULL,'carslota'int(12) NOT NULL,'carslotb' int(12) NOT NULL,'carslotc' int(12) NOT NULL,'carslotd' int(12) NOT NULL,'carslote' int(12) NOT NULL,'vipdia'   int(12) NOT NULL,'vipmes'   int(12) NOT NULL,'vipyear'  int(12) NOT NULL,'vip'        int(12) NOT NULL,PRIMARY KEY ('id') ) 
Lines
PHP код:
    new tmp[1024];
    
strcat(tmp,
    
"CREATE TABLE IF NOT EXISTS 'jugador' ( \
    'id'    int(12) NOT NULL AUTO_INCREMENT,\
    'nombre' varchar(24) NOT NULL,\
    'pass'      varchar(129) NOT NULL,\
    'salt'      varchar(30) NOT NULL,\
    'admin'    int(12) NOT NULL,\
    'nivel' int(12) NOT NULL,\
    'experiencia'int(12) NOT NULL,\
    'kills'         int(12) NOT NULL,\
    'deaths'     int(12) NOT NULL,\
    'damages'    int(12) NOT NULL,\
    'skin'       int(12) NOT NULL,"
);
    
strcat(tmp,
    
"'dinero'  int(12) NOT NULL,\
    'ingresoa' int(12) NOT NULL,\
    'ingresom' int(12) NOT NULL,\
    'ingresod' int(12) NOT NULL,\
    'mision'   int(12) NOT NULL,\
    'misionid' int(12) NOT NULL,\
    'misiondesert'  int(12) NOT NULL,\
    'misionshotgun' int(12) NOT NULL,\
    'misionmp5' int(12) NOT NULL,\
    'misionm4'  int(12) NOT NULL,\
    'misionak47'int(12) NOT NULL,\
    'misionsniper' int(12) NOT NULL,"
);
    
strcat(tmp,
    
"'carslota'int(12) NOT NULL,\
    'carslotb' int(12) NOT NULL,\
    'carslotc' int(12) NOT NULL,\
    'carslotd' int(12) NOT NULL,\
    'carslote' int(12) NOT NULL,\
    'vipdia'   int(12) NOT NULL,\
    'vipmes'   int(12) NOT NULL,\
    'vipyear'  int(12) NOT NULL,\
    'vip'        int(12) NOT NULL,\
    PRIMARY KEY ('id') )"
);
    
    
mysql_function_query(g_Handletmpfalse"SendQuery"""); 



Re: Error Mysql in samp - Vince - 10.02.2013

Table and fields name mustn't be wrapped in single quotes. Single quotes are reserved for literal strings only. Remove them. Furthermore, I'd suggest not creating tables from within the Pawn API. Trying to recreate a table that already exists, every time the server starts isn't very wise. And oh, forgot: use English throughout your scripts. Makes it just a little bit easier for people to help you.


Re: Error Mysql in samp - MP2 - 10.02.2013

To add to Vince's post, table/field names should be wrapped in ` these ` (what the fuck are they called?). If not, SQL might confuse the table/field name with a function name.


@Vince: Trying to recreate a table that already exists - isn't that the point of 'CREATE TABLE IF NOT EXISTS'?


Re: Error Mysql in samp - ReneG - 10.02.2013

Just throwing it out there ` are grave accents.