In this case, you don't "need an int", you need a value that's safe to put in a database query.
If you're inserting a value in a database, you always, always, always use the proper escaping mechanism. No exceptions.
That's why using a library with a reliable, well-defined, easy to use escaping system is absolutely imperative.