Hello! I'll keep things short & simple.
I'm stuck with
500k rows in 1 table. This causes extreme lag anytime someone connects to the server.
The Current Structure:
What I'm Trying to Accomplish:
Create:
PHP Code:
"CREATE TABLE `skills` ( `player_id` int(8) NOT NULL default '0', `skill_id` int(8) NOT NULL default '0', `skill_level` int(8) default NULL, PRIMARY KEY (`player_id`,`skill_id`) );",
Load:
PHP Code:
// Select the right Table
format( szQuery, charsmax( szQuery ), "SELECT `skill_id`, `skill_level` FROM `skills` WHERE ( `player_id` = '%d' );", p_data[id][PLAYER_UNIQUEID] );
query = SQL_PrepareQuery( g_DBConn, szQuery );
// While we have a result!
new iSkillID = 0;
while ( SQL_MoreResults( query ) )
{
iSkillID = SQL_ReadResult( query, 0 );
p_data_skill[id][iSkillID] = SQL_ReadResult( query, 1 );
SQL_NextRow( query );
}
Save:
PHP Code:
// Now we need to save the skill levels!
for ( new iSkillID = 0; iSkillID < MAX_SKILLS; iSkillID++ )
{
formatex( szQuery, 511, "REPLACE INTO `skills` ( `player_id` , `skill_id` , `skill_level` ) VALUES ( '%d', '%d', '%d' );", iUniqueID, iSkillID, p_data_skill[id][iSkillID] );
query = SQL_PrepareQuery( g_DBConn, szQuery );
}
How would I loop all skill_levels from a player_id into 1 field like shown in the 2nd image? Any help is GREATLY appreciated!