MySQL Error, not sure what though
#1

Alright. I've decided to come back to SA-MP scripting..


Anyways, This query should work but it is not returning any rows:

pawn Код:
Function:OnAccountLoad(playerid)
    {
        new
            rows,
            fields;

        cache_get_data(rows, fields);

        if(rows == 1)
        {
            for(new i = 0; i != rows; i++)
            {

                // Load Strings ----------------------------------------------------
                cache_get_field_content(i, "Password", Account[playerid][Password]);
                // -----------------------------------------------------------------

                // Load Integers ------------------------------------------------------------
                Account[playerid][AdminLevel] = cache_get_field_content_int(i, "AdminLevel");
                Account[playerid][Money] = cache_get_field_content_int(i, "money");
                Account[playerid][Faction] = cache_get_field_content_int(i, "faction");
                Account[playerid][pSkin] = cache_get_field_content_int(i, "skin");
                Account[playerid][pGender] = cache_get_field_content_int(i, "gender");
                // --------------------------------------------------------------------------
               
                // Set Money ----------------------------------------
                ResetPlayerMoney(playerid);
                GivePlayerMoney(playerid, Account[playerid][Money]);
                // --------------------------------------------------

                // Set Clothes -----------------------------------
                SetPlayerSkin(playerid, Account[playerid][pSkin]);
                // -----------------------------------------------

            }
        }
        else
        {
            SCM(playerid, -1, "Failed to load user data... [FTL ERR #1]");
            KickDelay(playerid);
        }
        return 1;
    }
Here's the query:

pawn Код:
mysql_format(sqlHandle, gVar3000, sizeof(gVar3000), "SELECT * FROM `samp_users` WHERE 'Username' = '%e' AND Password = '%e'", Name[playerid], Account[playerid][Password]);
        mysql_tquery(sqlHandle, gVar3000, "OnAccountLoad", "d", playerid);
Reply
#2

So what does the mysql log say about it?
Reply
#3

It said nothing about that query
Reply
#4

So are you sure it is sent? When are you sending it? I mean in which callback?
Reply
#5

Gonna try something hold on
Reply
#6

Sending this error but no idea if it's anything to do with it:


pawn Код:
[20:26:42] [ERROR] "cache_get_field_content_int" - invalid connection handle (ID = 0)
[20:26:42] [ERROR] "cache_get_field_content_int" - invalid connection handle (ID = 0)
[20:26:42] [ERROR] "cache_get_field_content_int" - invalid connection handle (ID = 0)
[20:26:42] [ERROR] "cache_get_field_content_int" - invalid connection handle (ID = 0)
[20:26:42] [ERROR] "cache_get_field_content_int" - invalid connection handle (ID = 0)
[20:26:42] [ERROR] "cache_get_field_content_int" - invalid connection handle (ID = 0)
[20:27:12] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.0.1, `health` = 0.000000, `armour` = 0.000000,`gender` = 0, `pDisX` = 50.000000' at line 1


Here's where the code is put

pawn Код:
case DIALOG_LOGIN:
            {
                new hash[129];
                WP_Hash(hash, sizeof(hash), inputtext);
               
                if(!strcmp(hash, Account[playerid][Password]))
                {
                    SCM(playerid, COLOR_GREEN, "You have successfully logged into "GAMEMODE_SHORTNAME". You will be spawned in a minute.");
                    SCM(playerid, COLOR_GREEN, "Remember, if you need help use "EMBED_WHITE"/assistance");
                    SCM(playerid, COLOR_GREEN, "And if you find a player is breaking the rules use "EMBED_WHITE"/report");

                    mysql_format(sqlHandle, gVar3000, sizeof(gVar3000), "SELECT * FROM `samp_users` WHERE 'Username' = '%s' AND Password = '%s'", Name[playerid], Account[playerid][Password]);
                    mysql_tquery(sqlHandle, gVar3000, "OnAccountLoad", "d", playerid);
                }
                else
                {
                    SCM(playerid, COLOR_DEATHRED, "[ERR] You appear to have entered an incorrect password.");
                    KickDelay(playerid);
                }
            }
the query is sending but always returning 0 rows
Reply
#7

Problem is persisting, need any help thanks.

Sorry for bumping this topic, it's just reaaaaly important that it gets fixed.
Reply
#8

remove the loop, replace the i with 0
Reply
#9

ok ill try it
Reply
#10

Still not working
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)