SA-MP Forums Archive
MySQL Escaping an Integer - 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 Escaping an Integer (/showthread.php?tid=590407)



MySQL Escaping an Integer - LiamM - 28.09.2015

Hello,

I have a system which involves a user inputting information into a parameter through a command they type. The input is using sscanf in which expects to receive an integer.

How do I exactly SQL Escape an integer? Seeing as it is not a string? Or is it not necessary, personally I don't feel it is necessary but perhaps it is. I do escape ALL strings however.


AW: MySQL Escaping an Integer - Kaliber - 28.09.2015

You dont need to escape Integers..because they are integers no strings..

To escape sth use '%e'


Re: MySQL Escaping an Integer - PrO.GameR - 28.09.2015

Escaping is used so people aren't able to alter your query to do what they want (for example tell mysql to drop table 'players' that you keep your information in), they can't do it with 1 integer (Since mysql commands are all at least words, like UPDATE ALTER DROP INSERT) therefore there is no need to do such thing.


Re: MySQL Escaping an Integer - LiamM - 28.09.2015

Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
Escaping is used so people aren't able to alter your query to do what they want (for example tell mysql to drop table 'players' that you keep your information in), they can't do it with 1 integer (Since mysql commands are all at least words, like UPDATE ALTER DROP INSERT) therefore there is no need to do such thing.
This is why I said I felt it was not necessary to do, I'm aware of what escaping the string did, and I was racking my brain to try and think of any potential way someone could alter a query with just a number but couldn't think of one. I always ask the community though JUST incase I never thought of something so obvious...

Thanks guys