Help with MySQL
#1

Hello, I have a question:

pawn Код:
case 2:
        {
            if(!response) return Kick(playerid);
            GetPlayerName(playerid, pName, sizeof(pName));
            mysql_real_escape_string(inputtext, escapepass);
            format(Query, sizeof(Query), "SELECT `name` FROM users WHERE name = '%s' AND password = '%s'", pName, escapepass);
            mysql_query(Query);
            mysql_store_result();
            if(!mysql_num_rows())
            {
                ShowPlayerDialog(playerid...)
            }
            else if(mysql_num_rows() == 1)
            {
                format(Query, sizeof(Query), "SELECT * FROM users WHERE name = '%s'", pName);
                mysql_query(Query);
                mysql_store_result();
                while(mysql_fetch_row_format(Query,"|"))
                {
                    mysql_fetch_field_row(field, "score");
                    SetPlayerScore(playerid, strval(field));
                    mysql_fetch_field_row(field, "money");
                    GivePlayerMoney(playerid, strval(field));
                    mysql_fetch_field_row(field, "adminlevel");
                    PlayerInfo[playerid][pAdminLevel] = strval(field);
                    mysql_fetch_field_row(field, "gang");
                    PlayerInfo[playerid][Gang] = strval(field);
                }
            //  mysql_free_result();
                PlayerInfo[playerid][pLogged] = 1;
            }
        //  mysql_free_result();
        }
Where would I need to free the result? the first or the second commented mysql_free_result line? If I uncomment both, in the debug log it will say the result is already empty, but which one would be the best choice?

thanks
Reply


Messages In This Thread
Help with MySQL - by Cowboy - 01.11.2011, 14:25
AW: Help with MySQL - by Nero_3D - 01.11.2011, 14:30
Re: Help with MySQL - by Cowboy - 01.11.2011, 14:33
Re: Help with MySQL - by Pinguinn - 01.11.2011, 14:35
Re: Help with MySQL - by Cowboy - 01.11.2011, 14:59
Re: Help with MySQL - by Pinguinn - 01.11.2011, 15:53
Re: Help with MySQL - by Cowboy - 01.11.2011, 16:40
Re: Help with MySQL - by Pinguinn - 01.11.2011, 16:52
Re: Help with MySQL - by Cowboy - 01.11.2011, 17:42

Forum Jump:


Users browsing this thread: 1 Guest(s)