MySQL's had enough?
#1

Hi there, I've recently downloaded an example script of MySQL.
Basically what this script does is save statistics to a player and stores them in an SQL' database.

Now, here's the main callback where I THINK the error occurs;

pawn Код:
stock LoginPlayer(playerid,pass[])
{
  new query[256],
        result[256],
        loop[256],
        poop = 1;
       
    MySQLCheck();
    samp_mysql_real_escape_string(GetPlayerNameEx(playerid),GetPlayerNameEx(playerid));
    samp_mysql_real_escape_string(pass,pass);
    format(query,sizeof(query),"SELECT * FROM `users` WHERE Username = '%s' AND Password = md5('%s')",GetPlayerNameEx(playerid),pass);
    samp_mysql_query(query);
    samp_mysql_store_result();
    samp_mysql_fetch_row(result);

    if(samp_mysql_num_rows() == 1)
    {
      samp_mysql_strtok(loop, "|", result);
      while(samp_mysql_strtok(loop, "|", ""))
        {
          if(poop == 3) AccountInfo[playerid][Points] = strval(loop);
          if(poop == 4) AccountInfo[playerid][Kills] = strval(loop);
          if(poop == 5) AccountInfo[playerid][Deaths] = strval(loop);
          if(poop == 6) AccountInfo[playerid][Admin] = strval(loop);
          if(poop == 7) AccountInfo[playerid][TimesQuit] = strval(loop);
          poop += 1;
        }
        samp_mysql_free_result();

        GivePlayerMoney(playerid, 1337);
        LoggedIn[playerid] = 1;
        SpawnPlayer(playerid);
        return 1;
    }
    else
    {
      SendClientMessage(playerid,COLOR_GREY,"  Invalid password.");
      Wrongattempt[playerid] += 1;
    }
    return 1;
}
(Sorry about the slight indentation screw up but, oh well). I cannot add more than 7, I try to add one more, when I connect to the server it just doesn't let me connect.

I can't see the problem, I'm fairly new to MySQL and I thought an example script was the way to go..
Any ideas how I could add more?

pawn Код:
if(poop == 8) AccountInfo[playerid][OneMoreRow] = strval(loop);
= rejected connection for everyone who attempts to connect.

Plus I'm not too bothered about array sizes right now, I don't know what MySQL array sizes are supposed to be so, yeah.
Reply


Messages In This Thread
MySQL's had enough? - by Lewwy - 18.07.2009, 16:45
Re: MySQL's had enough? - by help! - 13.10.2009, 08:42
Re: MySQL's had enough? - by Extremo - 13.10.2009, 10:58
Re: MySQL's had enough? - by Lewwy - 16.10.2009, 13:53

Forum Jump:


Users browsing this thread: 1 Guest(s)