MySQL table problem.
#1

pawn Код:
mysql_query("CREATE TABLE IF NOT EXIST `cuentas`(
        `id` int(11) NOT NULL autoincrement PRIMARY KEY,
        `nombre` varchar(24) NOT NULL,
        `pass` varchar(50) NOT NULL,
        `nivel` int(1) NOT NULL default `0`)"
);
Why is this giving me errors? Is there a better way to make it beside using just 1 line?

Errors:

pawn Код:
.pwn(1649) : error 037: invalid string (possibly non-terminated string)
.pwn(1649) : error 017: undefined symbol "TABLE"
.pwn(1649) : error 017: undefined symbol "IF"
.pwn(1649) : fatal error 107: too many error messages on one line
Reply
#2

Thank you Seif!

Edit:

Ok, I added more line and I got errors again...

pawn Код:
mysql_query ("CREATE TABLE IF NOT EXIST `jugadores`(\
                `id` int(11) NOT NULL autoincrement PRIMARY KEY,\
                `nombre` varchar(24) NOT NULL,\
                `seсa` varchar(50) NOT NULL,\
                `nivel` int(1) NOT NULL default `0`,\
                `ip` int(16) NOT NULL,\
                `correo` varchar(50) NOT NULL,\
                `fecha` date(15),\
                `ultima` datetime(20),\
                `sacadas` int(6) NOT NULL default `0`,\
                `banco` int(17) NOT NULL default `0`,\
                `carcel` int(3) NOT NULL default `0`,\
                `congelado` int(3) NOT NULL default `0`,\
                `dinero` int(8) NOT NULL default `0`,\
                `skin` int(3) NOT NULL,\
                `castigos` int(6) NOT NULL default `0`)"
);
error 075: input line too long (after substitutions)
error 037: invalid string (possibly non-terminated string)
Reply
#3

There is a limit to how long a line in of code in pawn can be. You can use format to overcome this problem I think.
Reply
#4

Yeah, thats the problem but how do I solved?
I searched a bit and read I should make variables for every line and format the query...
Can anyone show me how to do it or show me another solution?
Reply
#5

Please?
Reply
#6

pawn Код:
new iQuery[ 1024 ];
format(iQuery, 1024, "CREATE TABLE IF NOT EXIST `jugadores`(\
                `id` int(11) NOT NULL autoincrement PRIMARY KEY,\
                `nombre` varchar(24) NOT NULL,\
                `seсa` varchar(50) NOT NULL,\
                `nivel` int(1) NOT NULL default `0`,\
                `ip` int(16) NOT NULL,\
                `correo` varchar(50) NOT NULL,\
                `fecha` date(15),\
                `ultima` datetime(20),\
                `sacadas` int(6) NOT NULL default `0`,\
                `banco` int(17) NOT NULL default `0`,\
                `carcel` int(3) NOT NULL default `0`,\
                `congelado` int(3) NOT NULL default `0`,\
                `dinero` int(8) NOT NULL default `0`,\
                `skin` int(3) NOT NULL,\
                `castigos` int(6) NOT NULL default `0`)"
);
mysql_query(iQuery);
Reply
#7

Quote:
Originally Posted by //exora
pawn Код:
new iQuery[ 1024 ];
format(iQuery, 1024, "CREATE TABLE IF NOT EXIST `jugadores`(\
                `id` int(11) NOT NULL autoincrement PRIMARY KEY,\
                `nombre` varchar(24) NOT NULL,\
                `seсa` varchar(50) NOT NULL,\
                `nivel` int(1) NOT NULL default `0`,\
                `ip` int(16) NOT NULL,\
                `correo` varchar(50) NOT NULL,\
                `fecha` date(15),\
                `ultima` datetime(20),\
                `sacadas` int(6) NOT NULL default `0`,\
                `banco` int(17) NOT NULL default `0`,\
                `carcel` int(3) NOT NULL default `0`,\
                `congelado` int(3) NOT NULL default `0`,\
                `dinero` int(8) NOT NULL default `0`,\
                `skin` int(3) NOT NULL,\
                `castigos` int(6) NOT NULL default `0`)"
);
mysql_query(iQuery);
0
I don't think this would make the difference.
But you can just do two queries instead of one.
Reply
#8

Quote:
Originally Posted by MenaceX^
Quote:
Originally Posted by //exora
pawn Код:
new iQuery[ 1024 ];
format(iQuery, 1024, "CREATE TABLE IF NOT EXIST `jugadores`(\
                `id` int(11) NOT NULL autoincrement PRIMARY KEY,\
                `nombre` varchar(24) NOT NULL,\
                `seсa` varchar(50) NOT NULL,\
                `nivel` int(1) NOT NULL default `0`,\
                `ip` int(16) NOT NULL,\
                `correo` varchar(50) NOT NULL,\
                `fecha` date(15),\
                `ultima` datetime(20),\
                `sacadas` int(6) NOT NULL default `0`,\
                `banco` int(17) NOT NULL default `0`,\
                `carcel` int(3) NOT NULL default `0`,\
                `congelado` int(3) NOT NULL default `0`,\
                `dinero` int(8) NOT NULL default `0`,\
                `skin` int(3) NOT NULL,\
                `castigos` int(6) NOT NULL default `0`)"
);
mysql_query(iQuery);
0
I don't think this would make the difference.
But you can just do two queries instead of one.
It doesn't even work, I guess I'll have to make 2 tables.
Reply
#9

I have no idea if this will work and I've never done it, but you could try something like this:

pawn Код:
new query[3][1024]

format(query[0], size of query[0], "<first half of whatever>", <whatever arguments>);

format(query[1], size of query[1], "<second half of whatever>", <whatever arguments>);

format(query[2], size of query[2], "%s %s", query[0], query[1];

mysql_query(query[2]);
Reply
#10

Quote:
Originally Posted by radhakr
I have no idea if this will work and I've never done it, but you could try something like this:

pawn Код:
new query[3][1024]

format(query[0], size of query[0], "<first half of whatever>", <whatever arguments>);

format(query[1], size of query[1], "<second half of whatever>", <whatever arguments>);

format(query[2], size of query[2], "%s %s", query[0], query[1];

mysql_query(query[2]);
then I'll have to:
pawn Код:
mysql_query(query[0]);
mysql_query(query[1]);
mysql_query(query[2]);
?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)