24.07.2013, 21:09
I've used a query to create, if the table doesn't exists, the table called "bizs" with all info of BizInfo
But, unlike the users table, it doens't create, and the infos doens't get save.
Any help please? +rep
But, unlike the users table, it doens't create, and the infos doens't get save.
Код:
new dbstring[1024], bizquery[1024]; strcat(dbstring, "CREATE TABLE IF NOT EXISTS users (userid INTEGER PRIMARY KEY AUTOINCREMENT, username VARCHAR(24) COLLATE NOCASE, password VARCHAR(129),admin INT DEFAULT 0 NOT NULL, nome VARCHAR(24) COLLATE NOCASE, money INT DEFAULT 0 NOT NULL, level INT DEFAULT 1 NOT NULL, skin INT DEFAULT 299 NOT NULL, tutorial INT DEFAULT 0 NOT NULL"); strcat(dbstring, ",interior INT DEFAULT 0 NOT NULL, virtualworld INT DEFAULT 0 NOT NULL, anno INT DEFAULT 0 NOT NULL, mese INT DEFAULT 0 NOT NULL)"); db_query( Database, dbstring); //Till here it works, from here nope strcat(bizquery, "CREATE TABLE IF NOT EXISTS bizs (bizid INTEGER PRIMARY KEY AUTOINCREMENT, owned INTEGER DEFAULT 0 NOT NULL, owner VARCHAR(30), entratax FLOAT, entratay FLOAT, entrataz FLOAT, uscitax FLOAT, uscitay FLOAT, uscitaz FLOAT, locked INTEGER DEFAULT 0 NOT NULL, entrance INTEGER DEFAULT 0 NOT NULL, interior INT DEFAULT 0 NOT NULL"); strcat(bizquery, ", buyprice INTEGER DEFAULT 999999 NOT NULL"); db_query( Database, bizquery);
Код:
public SaveBiz() { for(new b=0; b < MAX_BIZ; b++) { new Query[ 128 ]; format( Query, sizeof( Query ), "UPDATE bizs SET owned = %d WHERE bizid = %d", BizInfo[b][bOwned], b); db_query( Database, Query ); } return 1; }