[Help] MySql
#1

Код:
mysql_query("CREATE TABLE IF NOT EXISTS Users(user VARCHAR(24), password VARCHAR(40), score INT(20), money INT(20), admin INT(20), vip INT(20), kills INT(20), deaths INT(20), jailed INT(20), banned INT(20), regular INT(20), housetospawnin INT(20), skin INT(20), min INT(20), hour INT(20), wanted INT(20), bank INT(20), raped INT(20), arrests INT(20), storesrobbed INT(20), banksrobbed INT(20), playersrobbed INT(20), fixed INT(20), ticketed INT(20), healed INT(20), tazzed INT(20), seed INT(20), weed INT(20), IP VARCHAR(15) )");
So input line is too long ,i m wondering can i continue this string , i need to add more variables ? Anyone


Errors:

C:\Users\Vedad\Desktop\CnC-MySQL.pwn(3655) : error 075: input line too long (after substitutions)
C:\Users\Vedad\Desktop\CnC-MySQL.pwn(3656) : error 037: invalid string (possibly non-terminated string)
C:\Users\Vedad\Desktop\CnC-MySQL.pwn(3656) : error 017: undefined symbol "CREATE"
C:\Users\Vedad\Desktop\CnC-MySQL.pwn(3656) : error 017: undefined symbol "TABLE"
C:\Users\Vedad\Desktop\CnC-MySQL.pwn(3656) : fatal error 107: too many error messages on one line
Reply
#2

Quote:
Originally Posted by DonWade
Посмотреть сообщение
Код:
mysql_query("CREATE TABLE IF NOT EXISTS Users(user VARCHAR(24), password VARCHAR(40), score INT(20), money INT(20), admin INT(20), vip INT(20), kills INT(20), deaths INT(20), jailed INT(20), banned INT(20), regular INT(20), housetospawnin INT(20), skin INT(20), min INT(20), hour INT(20), wanted INT(20), bank INT(20), raped INT(20), arrests INT(20), storesrobbed INT(20), banksrobbed INT(20), playersrobbed INT(20), fixed INT(20), ticketed INT(20), healed INT(20), tazzed INT(20), seed INT(20), weed INT(20), IP VARCHAR(15) )");
So input line is too long ,i m wondering can i continue this string , i need to add more variables ? Anyone


Errors:

C:\Users\Vedad\Desktop\CnC-MySQL.pwn(3655) : error 075: input line too long (after substitutions)
C:\Users\Vedad\Desktop\CnC-MySQL.pwn(3656) : error 037: invalid string (possibly non-terminated string)
C:\Users\Vedad\Desktop\CnC-MySQL.pwn(3656) : error 017: undefined symbol "CREATE"
C:\Users\Vedad\Desktop\CnC-MySQL.pwn(3656) : error 017: undefined symbol "TABLE"
C:\Users\Vedad\Desktop\CnC-MySQL.pwn(3656) : fatal error 107: too many error messages on one line
Even i have that problem and the whole Query needs to be in one line. So i deleted that line and Create The Tables myself.
Reply
#3

that should work

pawn Код:
new CreateQuery[2024];

strcat(CreateQuery, "CREATE TABLE IF NOT EXISTS Users(user VARCHAR(24), password VARCHAR(40), ");
strcat(CreateQuery, "score INT(20), money INT(20), admin INT(20), vip INT(20), kills INT(20), deaths INT(20), ");
strcat(CreateQuery, "jailed INT(20), banned INT(20), regular INT(20), housetospawnin INT(20), skin INT(20), ");
strcat(CreateQuery, "min INT(20), hour INT(20), wanted INT(20), bank INT(20), raped INT(20), arrests INT(20), storesrobbed INT(20), ");
strcat(CreateQuery, "banksrobbed INT(20), playersrobbed INT(20), fixed INT(20), ticketed INT(20), healed INT(20), ");
strcat(CreateQuery, "tazzed INT(20), seed INT(20), weed INT(20), IP VARCHAR(15) )");

mysql_query(CreateQuery);
Reply
#4

Quote:
Originally Posted by kirollos
Посмотреть сообщение
that should work

pawn Код:
new CreateQuery[2024];

strcat(CreateQuery, "CREATE TABLE IF NOT EXISTS Users(user VARCHAR(24), password VARCHAR(40), ");
strcat(CreateQuery, "score INT(20), money INT(20), admin INT(20), vip INT(20), kills INT(20), deaths INT(20), ");
strcat(CreateQuery, "jailed INT(20), banned INT(20), regular INT(20), housetospawnin INT(20), skin INT(20), ");
strcat(CreateQuery, "min INT(20), hour INT(20), wanted INT(20), bank INT(20), raped INT(20), arrests INT(20), storesrobbed INT(20), ");
strcat(CreateQuery, "banksrobbed INT(20), playersrobbed INT(20), fixed INT(20), ticketed INT(20), healed INT(20), ");
strcat(CreateQuery, "tazzed INT(20), seed INT(20), weed INT(20), IP VARCHAR(15) )");

mysql_query(CreateQuery);
I am using SQLite for my server and wanted to create a table. So i used your method and i got this error:
Код:
F:\CWWW3\TestingGM\gamemodes\CWSQL.pwn(1460) : error 035: argument type mismatch (argument 1)
Using the code
pawn Код:
database = db_open(DATABASE_FILE);
    new CreateQuery[2024];
    strcat(CreateQuery, "CREATE TABLE IF NOT EXISTS `Master` (`id` INTEGER PRIMARY KEY ,`username` VARCHAR(25)  ,`password` VARCHAR(12),`admin` INTEGER,`ip_address` VARCHAR(22),`old_ip` VARCHAR(22),`banned` INTEGER,`donaterank` INTEGER,`warns` INTEGER,`jail` INTEGER,`jailtime` INTEGER,`cash` INTEGER,");
    strcat(CreateQuery, "`kills` INTEGER,`deaths` INTEGER,`muted` INTEGER,`hide` INTEGER,`spree` INTEGER,`duelwon` INTEGER,`duellost` INTEGER, ");
    strcat(CreateQuery, "`clan` INTEGER,`clanrank` INTEGER,`level` INTEGER,`score` INTEGER,`bomb` INTEGER,`vmine` INTEGER,`hmine` INTEGER,`tmine` INTEGER,`c4` INTEGER )");
    db_query(CreateQuery);
    //Update table all the time if script doesnt creates creates the table. */
Do you know how can i fix this?
Reply
#5

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
Using the code
pawn Код:
db_query(CreateQuery);
Do you know how can i fix this?
pawn Код:
db_query(DB:db, query[]);
Reply
#6

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
pawn Код:
db_query(DB:db, query[]);
Oww My bad for the Syntax. I didnt check it lol. Ty Vinci! Rep+6 Added
Reply
#7

Sorry for bumping , but it works , +rep kirollos.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)