Error Mysql in samp
#1

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"""); 
Reply
#2

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.
Reply
#3

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'?
Reply
#4

Just throwing it out there ` are grave accents.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)