SA-MP Forums Archive
syntax error? - 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: syntax error? (/showthread.php?tid=231160)



syntax error? - Antonio [G-RP] - 25.02.2011

I've honestly no idea why I'm getting syntax errors on this code (the query).

pawn Код:
new buff[129];
                WP_Hash(buff, sizeof(buff), inputtext);
                mysql_real_escape_string(Name, EscapedName);
                mysql_real_escape_string(buff, EscapedPassword);
                #pragma unused Name
                format(Query, sizeof(Query), "INSERT INTO `accounts` (username, password) VALUES('%s', '%s')", EscapedName, EscapedPassword);
                mysql_query(Query);



Re: syntax error? - Calgon - 25.02.2011

You can't use one grave and fail to continue to use them (note, graves are the '`' characters), you need to wrap them around your columns too.

pawn Код:
format(Query, sizeof(Query), "INSERT INTO `accounts` (`username`, `password`) VALUES('%s', '%s')", EscapedName, EscapedPassword);



Re: syntax error? - Antonio [G-RP] - 25.02.2011

Ah, makes sense. Thanks for the reply, Calg00ne.