Can I make it shorter - MySQL
#3

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Yes if you have default values such as 0, there is no need to set it while registering a new row.
Default values can be set when you are creating a column in a MySQL table, either by code or manually.

For example:
You have default values of `Admin`, `VIP` etc. as 0. So your query can be:
pawn Код:
mysql_format(mysql, query, sizeof(query), "INSERT INTO `players` (`Username`, `Password`, `IP`) VALUES ('%e', '%s', '%s')", Name[playerid], pInfo[playerid][Password], IP[playerid]);
Makes sense indeed, thank you
Regarding player load
How can I load everything without a mass code ?
Example for mass code
PHP код:
pInfo[playerid][Admin] = cache_get_field_content_int(0"Admin"); //we're getting a field 4 from row 0. And since it's an integer, we use cache_get_row_int
     
pInfo[playerid][VIP] = cache_get_field_content_int(0"VIP"); //Above
     
pInfo[playerid][Money] = cache_get_field_content_int(0"Money");//Above
     
pInfo[playerid][posX] = cache_get_field_content_float(0"PosX");//Above. Since player's position is a float, we use cache_get_field_content_float
     
pInfo[playerid][posY] = cache_get_field_content_float(0"PosY");//Above
     
pInfo[playerid][posZ] = cache_get_field_content_float(0"PosZ");//Above 
Edit - in default values on column edition
Shall I put it NULL or otherwise?
Reply


Messages In This Thread
Can I make it shorter - MySQL - by NeXoR - 24.04.2016, 00:58
Re: Can I make it shorter - MySQL - by Gammix - 24.04.2016, 01:29
Re: Can I make it shorter - MySQL - by NeXoR - 24.04.2016, 01:44
Re: Can I make it shorter - MySQL - by Gammix - 24.04.2016, 01:47
Re: Can I make it shorter - MySQL - by NeXoR - 24.04.2016, 02:01
Re: Can I make it shorter - MySQL - by NeXoR - 24.04.2016, 02:12
Re: Can I make it shorter - MySQL - by Gammix - 24.04.2016, 02:23
Re: Can I make it shorter - MySQL - by Lordzy - 24.04.2016, 03:42
Re: Can I make it shorter - MySQL - by Lordzy - 24.04.2016, 15:03
Re: Can I make it shorter - MySQL - by NeXoR - 24.04.2016, 15:34

Forum Jump:


Users browsing this thread: 1 Guest(s)