mysql code
#1

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.
Reply
#2

Which line are you getting that error? And can you mark the line in your script?
Reply
#3

Hello,

The line where is the error is already mark on the code.
Reply
#4

comment the mysql_query and add print(query);
What do you get out of that?
Reply
#5

I don't get error when I add print(query); and comment mysql_query :O
What I have to do ?
Reply
#6

Run the script, and see what it prints in your console when this function is executed.
Reply
#7

Nothing ...
Reply
#8

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.
Reply
#9

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)