#1

Hello this line is too long I was wondering if there was a way to put the query's under eachother or something
Код:
db_query(Database, "CREATE TABLE IF NOT EXISTS Users (Userid INTEGER PRIMARY KEY AUTOINCREMENT, Username VARCHAR(24) COLLATE NOCASE, Password VARCHAR(129), Admin INTEGER DEFAULT 0 NOT NULL, Premium INTEGER DEFAULT 0 NOT NULL, Money INTEGER DEFAULT 0 NOT NULL, Score INTEGER DEFAULT 0 NOT NULL, Kills INTEGER DEFAULT 0 NOT NULL, Deaths INTEGER DEFAULT 0 NOT NULL, KD INTEGER DEFAULT 0 NOT NULL)");
Reply
#2

Use strcat. One tip: Save just the more important variables like Username, Password and if you have it, IP. For others save them manually.
Reply
#3

Aren't there faster ways to do this?
Reply
#4

Yes. With that code you're creating the table "Users", probably you're running it on OnGameModeInit, instead, open your database with phpmyadmin, and execute this query:

PHP код:
CREATE TABLE IF NOT EXISTS `Users` (
  `
Userid` int(10) NOT NULL,
  `
Username` varchar(24) NOT NULL,
  `
Password` varchar(129) NOT NULL,
  `
Admin` int(11) NOT NULL,
  `
Premium` int(11) NOT NULL,
  `
Money` int(11) NOT NULL,
  `
Score` int(11) NOT NULL,
  `
Kills` int(11) NOT NULL,
  `
Deaths` int(11) NOT NULL,
  `
Deaths` int(11) NOT NULL,
  `
KG` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1; 
Reply
#5

Sorry but im using SQL not MySQL I just need an efficient and fast way to make the columns without reducing speed...
Reply
#6

Emh....SQL is MySql...with the code your provided us it will create everytime the table, with my code just once.
Reply
#7

Im not creating the table everytime only if the table is non existant in scriptfiles while mysql needs a mysql server I only need a efficient way of creating the query's but Im not sure if there is a better way than strcat
Reply
#8

PHP код:
new tquery[512];
strcat(tquery,"CREATE TABLE IF NOT EXISTS Users (Userid INTEGER PRIMARY KEY AUTOINCREMENT,\
        Username VARCHAR(24) COLLATE NOCASE,\
        Password VARCHAR(129),\
        Admin INTEGER DEFAULT 0 NOT NULL,\
        Premium INTEGER DEFAULT 0 NOT NULL,\
        Money INTEGER DEFAULT 0 NOT NULL,"
);
strcat(tquery,"Score INTEGER DEFAULT 0 NOT NULL,\
        Kills INTEGER DEFAULT 0 NOT NULL,\
        Deaths INTEGER DEFAULT 0 NOT NULL,\
        KD INTEGER DEFAULT 0 NOT NULL)"
);
db_query(Database,tquery); 
Reply


Forum Jump:


Users browsing this thread: