SA-MP Forums Archive
mysql_query error - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: mysql_query error (/showthread.php?tid=507675)



mysql_query error - J4mmyHD - 18.04.2014

Hey guys, I have a little problem with Mysql_query. Here is the code.

pawn Code:
new query[126];
format(query, sizeof(query), "SELECT * FROM `users` WHERE Name = '%s'", PlayerName(playerid));
mysql_query(query); // Line 69

Code:
(69) : error 035: argument type mismatch (argument 1)
Help please.


Re: mysql_query error - iZN - 18.04.2014

pawn Code:
mysql_query(????, query);
PHP Code:
SELECT FROM `usersWHERE `Name` =  '%s' 
Would be great if you can also tell us which plugin you use. The version actually with name of the author.


Re: mysql_query error - Konstantinos - 18.04.2014

Open a_mysql.inc and search for "mysql_query". The first parameter should be the connection handle I think and then it's the query.


Re: mysql_query error - J4mmyHD - 18.04.2014

Quote:
Originally Posted by Konstantinos
View Post
Open a_mysql.inc and search for "mysql_query". The first parameter should be the connection handle I think and then it's the query.
What do I put for the Connection Handle then?


Re: mysql_query error - Konstantinos - 18.04.2014

You must store the connection handle to a global variable:
pawn Code:
new MySQL = -1;

// when connecting to MySQL:
MySQL = mysql_connect(...);

// when exiting the mode:
mysql_close(MySQL);

// in queries:
mysql_query(MySQL, query);



Re: mysql_query error - J4mmyHD - 18.04.2014

Quote:
Originally Posted by Konstantinos
View Post
Open a_mysql.inc and search for "mysql_query". The first parameter should be the connection handle I think and then it's the query.
Quote:
Originally Posted by Konstantinos
View Post
You must store the connection handle to a global variable:
pawn Code:
new MySQL = -1;

// when connecting to MySQL:
MySQL = mysql_connect(...);

// when exiting the mode:
mysql_close(MySQL);

// in queries:
mysql_query(MySQL, query);
Ahh Thanks for that +rep'd.


Re: mysql_query error - Rengers1 - 24.07.2015

Hi. Can You Help me?
How To Solve This Problem?

Quote:

new ok[200];
format(ok,sizeof(ok),"INSERT INTO mine (cutt) VALUES (%d)", cutt);
mysql_query(query); <<<<< This PRoblem