MySQL problem [EASY, ++REP]
#1

well, here it gets me arguement type mismatch

PHP код:
    if(dialogid == DIALOG_REGISTER)
    {
        if(
response)
        {
            if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD"Register""You should enter a password in order to continue""Register""Quit");
            new 
query[200], pName[MAX_PLAYER_NAME], tmp;
            
format(querysizeof(query), "SELECT id FROM accounts ORDER BY id DESC LIMIT 1");
            
mysql_query(query);
            
mysql_store_result();
            while(
mysql_fetch_row_format(query"|"))
            {
                
mysql_get_field("id"tmp);
                
strval(tmp);
                
tmp tmp 1;
            }
            
mysql_free_result();
            
GetPlayerName(playeridpNamesizeof(pName));
            
format(querysizeof(query), "INSERT INTO accounts(id, name, password) VALUES ('%i', '%s','%s')"tmppNameinputtext);
            
mysql_query(query);
            
SendClientMessage(playerid, -1"You have been registered");
        } 
Reply
#2

to make it easier, can I get something outside of mysql database(table) and use it generally in coding?

if it needs sscanf, please tell me how

Like that ID example
Reply
#3

Ugh, just use auto increment. And hash the passwords. And never use user input in a query without sanitizing it.
Reply
#4

You are getting a tag mismatch exception on 20 rows of code? Specify your row and don't let people guess.
Reply
#5

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
You are getting a tag mismatch exception on 20 rows of code? Specify your row and don't let people guess.
mysql_get_field("id", tmp);
Reply
#6

The second parameter must have been a string instead of an integer.

But.. do what Vince said, plus I suggest you to learn how to use threaded queries and update to R39-3.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)