MySQL Error ( I can't store some characters ) - 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: MySQL Error ( I can't store some characters ) (
/showthread.php?tid=658223)
MySQL Error ( I can't store some characters ) -
GospodinX - 27.08.2018
Hi guys,
I store every question/answer in my mysql database(For admin-panel)
But when player insert some characters i get some errors
For example if I type
I will get error for ' character..So I don't know how to fix it.
Example of my insert into query
Код:
INSERT INTO logovi SET `Staff`='%s', `Player`='%s', `Question`='%s', `Answer`='%s', `date`=UNIX_TIMESTAMP()", GetName(playerid),GetName(id),text,Ask[id][pText]);
Re: MySQL Error ( I can't store some characters ) -
Sew_Sumi - 27.08.2018
Apparently from what I've read and seen on the forums, you should be using escaped strings for anything a user can put in if it's going to the database, as they could put in the ' ending the string, and then run a code after to wipe your database clean.
What you need to look at though is escaped characters and such things.
Re: MySQL Error ( I can't store some characters ) -
iHollyZinhO - 02.09.2018
You can use " character instead of ' character. For example in this SQL code:
Код:
printf("INSERT INTO logovi (`Staff`, `Player`, `Question`, `Answer`, `date`) VALUES (\"%s\", \"%s\", \"%s\", \"%s\", %d)", [parameters...]);