Problem with loading values from MySQL
#1

Hey everyone.

I recently decided to change my script from files to MySQL and now i have trouble with loading the Player's data.
The Player Table contains 175 Values of all types. Ints, Floats and strings(but only [20]). When i try to load this I get either excessive memory usage(Server Crashes) or i can't get the Strings big enough that i need to store the data. I tried all the MySQL plugins except Gstylezz and none have worked for this so far.

If anyone could tell me the best and most effective way of loading these that would be great .

Thanks in Advance.
Reply
#2

Show one code where it would crash, i'll fix it.
Reply
#3

Well first I tried doing it this way:
Code:
format(query, sizeof(query), "SELECT * FROM `userinfo` WHERE `id` = %d LIMIT 1;", PlayerInfo[playerid][pSQLID]);
mysql_query(query);
mysql_store_result();
new Data[1000];
new Field[200][5];
mysql_fetch_row(Data, "|");
mysql_free_result();
split(Data, Field, '|');
PlayerInfo[playerid][pLevel] = strval( Field[3] );
PlayerInfo[playerid][pAdmin] = strval( Field[4] );
PlayerInfo[playerid][pDonateRank] = strval( Field[5] );
etc...
But i can't get Field big enough because max limit is 1024.

So then i tried loading each field seperately by its name using "mysql_fetch_field". But after 68th value the server would crash. I tried putting a different value but that didn't help. It would still crash at 68.
Reply
#4

Quote:
Originally Posted by Germanator
View Post
Well first I tried doing it this way:
Code:
format(query, sizeof(query), "SELECT * FROM `userinfo` WHERE `id` = %d LIMIT 1;", PlayerInfo[playerid][pSQLID]);
mysql_query(query);
mysql_store_result();
new Data[1000];
new Field[200][5];
mysql_fetch_row(Data, "|");
mysql_free_result();
split(Data, Field, '|');
PlayerInfo[playerid][pLevel] = strval( Field[3] );
PlayerInfo[playerid][pAdmin] = strval( Field[4] );
PlayerInfo[playerid][pDonateRank] = strval( Field[5] );
etc...
But i can't get Field big enough because max limit is 1024.

So then i tried loading each field seperately by its name using "mysql_fetch_field". But after 68th value the server would crash. I tried putting a different value but that didn't help. It would still crash at 68.
What do you mean big enough? What field is past 1024 characters?
Reply
#5

"Field[200][5];" is for the function "split". But i have to load bigger strings than size 5 from the players file. But I can't make field big enough to save more than 5 letters. Because it's 200x5 which is already 1000.

Maybe there is a different more efficient way of loading values from MySQL than using the "split" function?
Reply
#6

---bump---
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)