MySQL table problem. -
M1GU3L - 02.12.2009
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
Re: MySQL table problem. -
M1GU3L - 02.12.2009
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)
Re: MySQL table problem. -
radhakr - 02.12.2009
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.
Re: MySQL table problem. -
M1GU3L - 02.12.2009
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?
Re: MySQL table problem. -
M1GU3L - 04.12.2009
Please?
Re: MySQL table problem. -
woot - 04.12.2009
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);
Re: MySQL table problem. -
MenaceX^ - 04.12.2009
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.
Re: MySQL table problem. -
M1GU3L - 04.12.2009
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.
Re: MySQL table problem. -
radhakr - 04.12.2009
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]);
Re: MySQL table problem. -
M1GU3L - 05.12.2009
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]);
?