SA-MP Forums Archive
Table isn't being created (MYSQL)... - 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: Table isn't being created (MYSQL)... (/showthread.php?tid=485786)



Table isn't being created (MYSQL)... - TH3_R3D™ - 05.01.2014

Hey,

I've other table rather than this but it works correctly because it's not that long,
though I split my long input, it's not created.

Here's the query:

pawn Код:
new query[500];
    format(query, sizeof(query), "CREATE TABLE IF NOT EXISTS playerdata(user VARCHAR(24) NOT NULL auto_increment PRIMARY KEY, password VARCHAR(40) NOT NULL,");
    strcat(query, "IP VARCHAR(16) NOT NULL, money INT(20) NOT NULL default '0' , skin INT(10) NOT NULL default '0', scores INT(30) NOT NULL default '0', adminlevel INT(10) NOT NULL default '0', helperlevel INT(10) NOT NULL default '0',");
    strcat(query, "kills INT(20) NOT NULL default '0', deaths INT(20) NOT NULL default '0', floatx INT(20) NOT NULL default '0', floaty INT(20) NOT NULL default '0', floatz INT(20) NOT NULL default '0', floatr INT(20) NOT NULL default '0' )");
    mysql_query(query);
Thanks for any help!


Re: MYSQL isn't creating a table... - Konstantinos - 05.01.2014

The size is not enough.

pawn Код:
new query[558] = "CREATE TABLE IF NOT EXISTS playerdata(user VARCHAR(24) NOT NULL auto_increment PRIMARY KEY, password VARCHAR(40) NOT NULL,";
strcat(query, "IP VARCHAR(16) NOT NULL, money INT(20) NOT NULL default '0', skin INT(10) NOT NULL default '0', scores INT(30) NOT NULL default '0', adminlevel INT(10) NOT NULL default '0', helperlevel INT(10) NOT NULL default '0',");
strcat(query, "kills INT(20) NOT NULL default '0', deaths INT(20) NOT NULL default '0', floatx INT(20) NOT NULL default '0', floaty INT(20) NOT NULL default '0', floatz INT(20) NOT NULL default '0', floatr INT(20) NOT NULL default '0')");



Re: Table isn't being created (MYSQL)... - mxstr - 05.01.2014

Quote:
Originally Posted by TH3_R3D™
Посмотреть сообщение
new query[500];
This little.

And what about ' ' and ` `?


Re: Table isn't being created (MYSQL)... - TH3_R3D™ - 05.01.2014

no effect!


Re: Table isn't being created (MYSQL)... - tyler12 - 05.01.2014

The length of the query is 561 characters.

new query[562];


Re: Table isn't being created (MYSQL)... - Konstantinos - 05.01.2014

I hope if you pasted the code I gave to keep the mysql_query line!

print query:
pawn Код:
print(query);
after the mysql_query line and also check the mysql log file for further information.


Re: Table isn't being created (MYSQL)... - Vince - 05.01.2014

Create tables outside of the script. Wasting resources on something that's only to be done once is useless.


Re: Table isn't being created (MYSQL)... - TH3_R3D™ - 05.01.2014

lol, I removed that line "auto_increment PRIMARY KEY" as a result, it worked but what's wrong?