Mysql Query Insert %s - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Mysql Query Insert %s (
/showthread.php?tid=187375)
Mysql Query Insert %s -
wouter0100 - 02.11.2010
Hello,
I have made this script:
Код:
mysql_query("INSERT INTO `users` (`Name`, `Password`, `Admin`, `Money`, `Score`, `Language`) VALUES ('%s', '%s', '0', '10000', '0', '0')", PlayerInfo[playerid][pName], udb_hash(inputtext));
Whats wrong?
He insert by Name and Password this: %s And he must me insert the playername? (PlayerInfo[playerid][pName] is good)
Thanks.
Wouter0100.
Re: Mysql Query Insert %s -
Grim_ - 02.11.2010
You need to format the query:
pawn Код:
new Query[150];
format(Query, 150, "INSERT INTO `users` (`Name`, `Password`, `Admin`, `Money`, `Score`, `Language`) VALUES ('%s', '%s', 0, 10000, 0, 0)", PlayerInfo[playerid][pName], udb_hash(inputtext));
mysql_query(Query);
And no need for the ' around integers, they are only needed for strings.
Re: Mysql Query Insert %s -
wouter0100 - 02.11.2010
Thanks for help!
Re: Mysql Query Insert %s -
wouter0100 - 02.11.2010
Whats Here wrong?
Код:
if(inputtext != tmp) {
This error:
Код:
C:\Users\Wouter\Desktop\samp03bsvr_R2_win32\gamemodes\bare.pwn(326) : error 033: array must be indexed (variable "inputtext")
Re: Mysql Query Insert %s -
Hornet600 - 02.11.2010
you could use a string too
Re: Mysql Query Insert %s -
ivex - 02.11.2010
udb_hash(inputtext) is an integer value i think .. use %d ... try like this
Re: Mysql Query Insert %s -
Grim_ - 02.11.2010
pawn Код:
if(strcmp(tmp, inputtext, true) != 0)
Re: Mysql Query Insert %s -
wouter0100 - 02.11.2010
Grim_ Thanks, not work

Hornet kan je make that for me pleas?
Here's the code:
Код:
new tmp;
mysql_query("SELECT `Password` FROM `users` WHERE `Name` = '%d'",PlayerInfo[playerid][pName]);
tmp = mysql_store_result();
if(inputtext != tmp) {