MySQL problem!
#1

I have all includes & plugins installed in my server folder.

But, I get an error when I compile the script:
test.pwn(76) : error 035: argument type mismatch (argument 1)

pawn Код:
new query[126];
   
format( query, sizeof(query), "SELECT * FROM accounts WHERE name = '%s'", GetName(playerid) ); // I have already made a stock to get player name.
mysql_query(query); // This is line 76..
mysql_store_result();
Any solutions?
Reply
#2

Help?
Reply
#3

Depending on your MySQL plugin version, mysql_query has more parameters.
Look up the a_mysql.inc file and see what mysql_query expects (I'm guessing handle, query string, callback, format, ...)
Reply
#4

native Cache:mysql_query(conhandle, query[], bool:use_cache = true);
This is what I get when I search for mysql_query in a_mysql.inc.
I'm using BlueG's plugin..
Reply
#5

String that you have created, query, is the second parameter, not the first one. I'm using SQLite so I can't tell you about the first parameter, I'm sorry.
Reply
#6

mysql_query(const query[], resultid, spareid, MySQL:handle)
resultid and spareid is optional. What is MySQL:handle?
Reply
#7

something = mysql_connect(...);
"something" is sql handle
Reply
#8

pawn Код:
new query[126];
   
    format( query, sizeof(query), "SELECT * FROM accounts WHERE name = '%s'", GetName(playerid) );
    mysql_query(query);
    mysql_store_result();
   
    if ( mysql_num_rows() == 1)
    {
        new str[100];
        format( str, sizeof(str), ""PINK" Your username (%s) is registered.", GetName(playerid) );
        SendClientMessage( playerid, -1, str );
        ShowPlayerDialog( playerid, 0, DIALOG_STYLE_INPUT, ""RED"Login", "{2CE8BF}Please enter your password to login.", "Login", "Cancel" );
    }
    else
    {
        new str[126];
        format( str, sizeof(str), ""PINK" Your username (%s) is not registered. Please register your username!", GetName(playerid) );
        SendClientMessage( playerid, -1, str );
    }
    return 1;
}
Please help.
Reply
#9

pawn Код:
format( query, sizeof(query), "SELECT * FROM accounts WHERE name = '%s'", GetName(playerid) );
mysql_query(1, query, false);
Reply
#10

Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)