Strings in strcat - MySQL
#6

Look how to use DEFAULT and complete the rest of the table

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) )"
);
then you can use only

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;
}
looks better ?

remember if you need only small numbers don't use INT()
here for example
pawn Код:
rentprice INT(20),\
driverlic INT(20),\
flylic INT(20) )");
read about data types

http://www.w3schools.com/sql/sql_datatypes.asp
Reply


Messages In This Thread
Strings in strcat - MySQL - by Brandon_More - 06.11.2013, 22:45
Re: Strings in strcat - MySQL - by Jefff - 06.11.2013, 22:48
Re: Strings in strcat - MySQL - by Brandon_More - 06.11.2013, 23:06
Re: Strings in strcat - MySQL - by Jefff - 06.11.2013, 23:35
Re: Strings in strcat - MySQL - by Brandon_More - 06.11.2013, 23:44
Re: Strings in strcat - MySQL - by Jefff - 07.11.2013, 00:04
Re: Strings in strcat - MySQL - by Brandon_More - 07.11.2013, 02:02

Forum Jump:


Users browsing this thread: 1 Guest(s)