07.11.2013, 00:04
Look how to use DEFAULT and complete the rest of the table
then you can use only
looks better ?
remember if you need only small numbers don't use INT()
here for example
read about data types
http://www.w3schools.com/sql/sql_datatypes.asp
pawn Код:
mysql_query("CREATE TABLE IF NOT EXISTS playerdata (\
user VARCHAR(24) NOT NULL,\
password VARCHAR(40) NOT NULL,\
bank INT(10) UNSIGNED NOT NULL DEFAULT 0,\
money INT(10) NOT NULL DEFAULT 10000,\
playerlvl SMALLINT(5) UNSIGNED NOT NULL DEFAULT 1,\
rpoints SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0,\
playertime INT(10) UNSIGNED NOT NULL DEFAULT 0,\
jail SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0,\
jailreason VARCHAR(24) NOT NULL DEFAULT 'Not Jailed',\
jailtime SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0,\
banned SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0,\
banreason VARCHAR(24) NOT NULL DEFAULT 'Not Banned',\
whobannedme VARCHAR(24) NOT NULL DEFAULT 'NoBodY',\
whenigotbanned VARCHAR(24) NOT NULL DEFAULT 'NoBodY',\
Skin SMALLINT(3) UNSIGNED NOT NULL DEFAULT 7,\
ranklvl SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0,\
rentprice INT(20),\
driverlic INT(20),\
flylic INT(20) )");
pawn Код:
MySQL_Register(playerid, passwordstring[])
{
new query[ 150 ], pname[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(query,sizeof(query),"INSERT INTO playerdata (user, password) VALUES ('%s', SHA1('%s'));",pname, passwordstring);
mysql_query(query);
SendClientInfo(playerid, "Congradulations, you have now registed. You will be spawned at SF train Station");
PLAYERLIST_authed[playerid] = true;
return;
}
remember if you need only small numbers don't use INT()
here for example
pawn Код:
rentprice INT(20),\
driverlic INT(20),\
flylic INT(20) )");
http://www.w3schools.com/sql/sql_datatypes.asp