11.11.2018, 17:56
I want to store multiple values in one field in the MySQL database.
This is the way I am currently using to store data (convert to string and concatenate a comma)
This is my enum:
When I get the data, I am using
Please tell me a way to remove these commas and store back into the array I am using in the enum.
Also, I am highly unsatisfied by this code. If you guys have any better way to do this, please let me know. This is an urgency.
This is the way I am currently using to store data (convert to string and concatenate a comma)
PHP код:
for(new i = 0; i < 10; i++) {
Player[playerid][playerPmBlocks][i] = 0;
valstr(temp, Player[playerid][playerPmBlocks][i]);
strcat(blockstring, temp, sizeof(blockstring));
strcat(blockstring, ",", sizeof(blockstring));
}
PHP код:
enum PlayerInfo {
playerPmBlocks[255]
};
new Player[MAX_PLAYERS][PlayerInfo];
PHP код:
cache_get_value(0, "ppmblocks", tempblocks, 255);
Also, I am highly unsatisfied by this code. If you guys have any better way to do this, please let me know. This is an urgency.