SA-MP Forums Archive
Little 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: Little MySQL Problem. (/showthread.php?tid=482651)



Little MySQL Problem. - qazwsx - 22.12.2013

Hello.

Im currently learning some stuffs in MySQL these days. I got lil problem in MySQL. so here is the code:
pawn Код:
public OnPlayerConnect(playerid)
{
    new querry[64],pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,sizeof(pName));
    format(querry,"SELECT `password` FROM `users` WHERE `username` = '%s'",pName);
    mysql_query(querry);
    mysql_store_result();
    return 1;
}
As you guys know, to fix error argument type mismatch (argument 2), We have to do format string and send that string to database. And i did in my code above. But im still getting that error. Did i make a fault?

I hope you guys would help me, as im new in MySQL


thank you


Re: Little MySQL Problem. - Konstantinos - 22.12.2013

You forgot the lenght.

pawn Код:
format(querry,sizeof(query),"SELECT `password` FROM `users` WHERE `username` = '%s'",pName);



Re: Little MySQL Problem. - qazwsx - 22.12.2013

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You forgot the lenght.

pawn Код:
format(querry,sizeof(query),"SELECT `password` FROM `users` WHERE `username` = '%s'",pName);
Damn LOL!
how did i forgot it? xDDD

Anw, thank you for help

+REP