That should work most of the time.
Keep in mind that if you're using a login system, do not let the player spawn until the bar() function has completed with success. If no success, re-try the query or try another query.
Also, dont loop through your stats. Thats just plain stupid.
PHP Code:
loadstats()
{
result = [[level.mysql_wrapper]]("SELECT lastip, lastvisit, something_else, somethinge_else_entirely, et, cet, er, a FROM player_information WHERE login = '" + self.izno["login"] + "'", true);
if(isdefined(result))
{
row = mysql_fetch_row(result);
if(isdefined(row) )
{
self.stats["lastip"] = row[0];
self.stats["lastvisit"] = row[1];
self.stats["something_else"] = int(row[2]);
self.stats["something_else_entirely"] = int(row[3]);
self.stats["et"] = int(row[4]);
self.stats["cet"] = int(row[5]);
self.stats["er"] = int(row[6]);
self.stats["a"] = int(row[7]);
}
mysql_free_result(result);
}
}
Already saves you 7 queries.