MySQL is not loading my information
#1

Well so I moved to MySQL instead of SQLite, I used DBConverter and when I attempt to login the server, It tells me to register, Even if I registered and im relogging it tells me to register again

Thats the code where it loads the account information.

Код:
format(string, sizeof(string), "SELECT * FROM `accounts` WHERE `Username` = '%s' AND `Password` = '%s'", playername, password);
Well its not working, PHPMyAdmin shows all the tables are in the database, Everything should work, Please help anyone
Reply
#2

That's querying the data, you need to collect the information from the rows that are stored.

Have a look @ this tutorial by AndreT:

https://sampforum.blast.hk/showthread.php?tid=337810
Reply
#3

Quote:
Originally Posted by d3ll
Посмотреть сообщение
That's querying the data, you need to collect the information from the rows that are stored.

Have a look @ this tutorial by AndreT:

https://sampforum.blast.hk/showthread.php?tid=337810
Do you mean that I have to replace the line with:
Код:
mysql_function_query(dbHandle, "SELECT * FROM accounts WHERE `Username` = '%s' AND `Password` = '%s'", playername, password);
Taken from the tutorial you gave me.
Reply
#4

This is my OnPlayerConnect.


pawn Код:
public OnPlayerConnect(playerid)
{
    new query[126];
   
    if(Checkban(playerid) == 0)
    {
        format(query, sizeof(query), "SELECT * FROM accounts WHERE pName = '%s'", GetName(playerid));
        mysql_query(query);
        mysql_store_result();
       
        if(mysql_num_rows() == 1)
        {
            SendClientMessage(playerid, -1, "That username is registered!");
            ShowPlayerDialog(playerid, dialogThreadLogin, DIALOG_STYLE_INPUT, "Login", "Please login with the password you made", "Login", "Cancel");
        }
        else
        {
            SendClientMessage(playerid, -1, "That username is not registered. You may register it");
            ShowPlayerDialog(playerid, dialogThreadRegister, DIALOG_STYLE_INPUT, "Register", "Please enter a password you will remember", "Register", "Cancel");
        }
    }

    return 1;
}
So in your case you would probably just need:

pawn Код:
new query[126]

format(query, sizeof(query), "SELECT * FROM accounts WHERE pName = '%s'", GetName(playerid));
Reply
#5

How are you fetching the data and assigning it to variables?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)