mysql code - 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 code (
/showthread.php?tid=511692)
mysql code -
jcvag44800 - 06.05.2014
Hello,
Someone can help me to ensure that this code can work with the BlueG Mysql plugin ?
This is the code:
Код:
public MySQLUpdateBuild(query[], sqlplayerid) // by Luk0r
{
new querylen = strlen(query);
//new querymax = sizeof(query);
new querymax = MAX_STRING;
if (querylen < 1) format(query, querymax, "UPDATE players SET ");
else if (querymax-querylen < 50) // make sure we're being safe here
{
// query is too large, send this one and reset
new whereclause[32];
format(whereclause, sizeof(whereclause), " WHERE id=%d", sqlplayerid);
strcat(query, whereclause, querymax);
mysql_query(query); <-- This line
format(query, querymax, "UPDATE players SET ");
}
else if (strfind(query, "=", true) != -1) strcat(query, ",", MAX_STRING);
return 1;
}
I start but I get this error: error 035: argument type mismatch (argument 1)
Regards.
Re: mysql code -
Aerotactics - 06.05.2014
Which line are you getting that error? And can you mark the line in your script?
Re: mysql code -
jcvag44800 - 07.05.2014
Hello,
The line where is the error is already mark on the code.
Re: mysql code -
Roel - 07.05.2014
comment the mysql_query and add print(query);
What do you get out of that?
Re : mysql code -
jcvag44800 - 07.05.2014
I don't get error when I add print(query); and comment mysql_query :O
What I have to do ?
Re: mysql code -
Roel - 07.05.2014
Run the script, and see what it prints in your console when this function is executed.
Re : mysql code -
jcvag44800 - 07.05.2014
Nothing ...
Re: mysql code -
iZN - 07.05.2014
Why would even use some function to update your data seriously? Get some knowledge about MySQL syntax and you won't even need to use that.
Re: mysql code -
Roel - 07.05.2014
Quote:
Originally Posted by iZN
Why would even use some function to update your data seriously? Get some knowledge about MySQL syntax and you won't even need to use that.
|
Have to agree.
Re: mysql code -
JoeMercury - 07.05.2014
Ah, yes feel the love in the room.
@jcvag44800: Is it possible, that you are calling the function and feeding it bad data? For example;
MySQLUpdateBuild("My bad data", playerid)
Error messages don't always point directly at the problem.
If not, you will need to run a debug trace on that variable string query to find out where it becomes a null string. For example; a series of printf (query); though out your function to track the changes.