MySQL Reg help.
#1

I'm not sure what I am having a problem with right now, seems as everything is fine;

pawn Код:
if(dialogid == DReg)
    {
        if(response == 1)
        {
            new
                str[128],
                password[50];
            format(str, 128, "SELECT * FROM `playerinfo` WHERE `user` = '%s'", pName(playerid));
            mysql_query(str);
            mysql_store_result();
            if(mysql_num_rows() == 1)
            {
                SendClientMessage(playerid, RED, "ERROR: This account is already registered!");
                ShowPlayerDialog(playerid, DLogin, DIALOG_STYLE_INPUT, "RC:RP Login", "Please enter your password below to login", "Login", "Cancel");
                mysql_free_result();
                return 1;
            }
            mysql_free_result();
            CMySQL_Create(str, ACCOUNT_TABLE, "User");
            CMySQL_Password(str, ACCOUNT_TABLE, "Password", inputtext);
            CMySQL_SetInt(str, ACCOUNT_TABLE, "User", "Money", 5000);
        }
        else
        {
            SendClientMessage(playerid, GREEN, "You have cancelled registration, you have been kicked");
            Kick(playerid);
        }
    }
This is my dialog code; used for DIALOG_STYLE_INPUT.

I have tried registering, but it comes out pretty odd.
Console Output (Stricken Kid's):
Quote:

[12:59:22] [join] Toni_Tang has joined the server (0:192.168.1.75)
[12:59:27] MySQL Error (0): Could not execute query. 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 'SELECT * FROM `playerinfo` WHERE `user` = \'Toni_Tang\' = ''' at line 1.

And this is the output after registering in phpMyAdmin:
Quote:

SELECT * FROM `playerinf

Apparently that was my value 'username'.

Can someone please help.
Reply
#2

Sorry for the bump, I really need help.
Reply
#3

can someone help him;\
Reply
#4

Which line is causing the problem?
Reply
#5

Idnno..I'm guessing the format(str one.
Reply
#6

i believe its this

pawn Код:
format(str, 128, "SELECT * FROM `playerinfo` WHERE `user` = '%s'", pName(playerid));
            mysql_query(str);
            mysql_store_result();
as said in the error. he posted

edit try this

pawn Код:
new Query[200], Pname[24]; //Creates the Query string and the Pname
    GetPlayerName(playerid, Pname, 24); //Gets the players name
    format(Query, sizeof(Query), "SELECT * FROM `playerinfo` WHERE `user` = '%s'", Pname); //Selects the line where the playername is the player
    mysql_query(Query); //Querys the string
    mysql_store_result(); //Stores the result
ik it doesnt look like a difference has been made.
Reply
#7

It looks right to me, but just incase

pawn Код:
mysql_real_escape_string(pName(playerid), str);
format(str, 128, "SELECT * FROM `playerinfo` WHERE `user` = '%s'", str);
mysql_query(str);
mysql_store_result();
Reply
#8

Quote:
Originally Posted by Carlton
Посмотреть сообщение
It looks right to me, but just incase

pawn Код:
mysql_real_escape_string(pName(playerid), str);
format(str, 128, "SELECT * FROM `playerinfo` WHERE `user` = '%s'", str);
mysql_query(str);
mysql_store_result();
Sorry to say, it didn't work :/
Reply
#9

ffs lol just use the reg system i gave you why do u even need to change it
Reply
#10

Quote:
Originally Posted by Kar
Посмотреть сообщение
ffs lol just use the reg system i gave you why do u even need to change it
Meh.

Anyone else have ideas on how to fix?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)