MySQL problem! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL problem! (
/showthread.php?tid=484912)
MySQL problem! -
SevenSlash - 02.01.2014
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?
Re: MySQL problem! -
SevenSlash - 02.01.2014
Help?
Re: MySQL problem! -
Sinner - 02.01.2014
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, ...)
Re: MySQL problem! -
SevenSlash - 02.01.2014
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..
Re: MySQL problem! -
dominik523 - 02.01.2014
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.
Re: MySQL problem! -
SevenSlash - 02.01.2014
mysql_query(const query[], resultid, spareid, MySQL:handle)
resultid and
spareid is optional. What is MySQL:handle?
Re: MySQL problem! -
newbienoob - 02.01.2014
something = mysql_connect(...);
"something" is sql handle
Re: MySQL problem! -
SevenSlash - 02.01.2014
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.
Re: MySQL problem! -
iZN - 02.01.2014
pawn Код:
format( query, sizeof(query), "SELECT * FROM accounts WHERE name = '%s'", GetName(playerid) );
mysql_query(1, query, false);
Re: MySQL problem! -
SevenSlash - 02.01.2014
Thanks!