I work at a company that's still using mysqli connection. I know that PDO is better and we should be using that but changing to that would require a lot of work that we don't have time for. Our goal is to switch the company website to Laravel sometime in the future.
I know the mysqli class also has a prepare function but it doesn't really fit into the class we made to work with mysqli.
Until then, is mysql going to convert $_POST string variables into INT or DECIMAL types or do I need to use real_escape_string on ALL variables in the sql string regardless of whether or not it's being saved to a string or INT column.
Addon question: Is real_escape_string going to protect me from injections?
Example code:
$sql = "
INSERT INTO table
(
column
)
VALUE
(
" . $mysqli_connection->real_escape_string($_POST['number']) . "
)";
$mysqli_connection->query($sql);