PDA

View Full Version : new query(mysql) +REP !


[BG]PREDATOR
21/05/2012, 02:51 PM
Hello can someone explain me how it work new query old was mysq_query and new is mysql_function_query

here example that in trying to do

CMD:kill(playerid,params[])
{
new query[256];
format(query,sizeof(query),"INSERT INTO `playerdata` (`username`,`password`,) VALUES (`Fear`,`123`");
mysql_function_query(1, query, false,"","","");
SendClientMessage(playerid,-1,"test");
return 1;
}

Mandrakke
21/05/2012, 02:59 PM
you have syntax errors on that query, try it below;

format(query, sizeof(query), "INSERT INTO playerdata (username, password) VALUES ('Fear', 123)");



- edit -
If it won't work, tell which plugin you use.

doreto
21/05/2012, 03:03 PM
edit:wrong topic im sorry

[BG]PREDATOR
21/05/2012, 03:04 PM
i get this error when i mysql debug CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()

Mandrakke
21/05/2012, 03:04 PM
right, paste it somewhere in to your GM and paste here the console output;

public OnQueryError(errorid, error[], resultid, extraid, callback[], query[], connectionHandle)
{
printf("%d %s %d %d %s %s %d", errorid, error, resultid, extraid, callback, query, connectionHandle);
return 1;
}

[BG]PREDATOR
21/05/2012, 03:14 PM
you have syntax errors on that query, try it below;

format(query, sizeof(query), "INSERT INTO playerdata (username, password) VALUES ('Fear', 123)");



- edit -
If it won't work, tell which plugin you use.


ty very much but what have you change its same like i see can you please tell me i rep you

Mandrakke
21/05/2012, 03:19 PM
INSERT INTO `playerdata` (`username`,`password`,) VALUES (`Fear`,`123`"

1 - there is an ")" missing after "123".
2 - there is an "," after "password" and no one field declared, this result in to an syntax error.
3 - Values cannot be placed between `, they need to be between ' or ".

I don't know how to express myself very well in english, but I think you can understand what I said.


also you don't have to rep me for this.