I have:
$height = mysqli_real_escape_string($connect, $_POST['height'];
Which inserts an integer value to an INT database field.
When I select the same value back from the database I get a whole different number...
Is it real escape? Or is it a specific filter that i should use?
Thank you so much
EDIT
First of all, thank all of you who are being a real help!!!
Here is my code:
I have a sql field called height INT(3)
the form input is as such:
the query is:
$sql = mysqli_query($connect, "INSERT INTO patient (height) VALUES ('$height')");
the code triggering this query is:
if (isset($_POST['dossier'])) {
$height = mysqli_real_escape_string($connect, $_POST['height']);
}
Now, lets say I post 4, then I echo the $height variable I get 5...
First time I get this error...
Thank you so much!!
LAST EDIT
I found the problem!!!
I had a mathematical calculation where I used a wrong operator:
if ($row['gender'] === "m") {
if ($height = 5) { // <------ RIGHT HERE!!!!!
$height_measure = 106 + ($height_dec * 6);
}
So I changed the operator to === and now everything works fine again!!!!
Thanks for those who tried to help! And those who voted negative, you could have been more of a help and at least direct me to a replicated question or something!!! :) You know, constructive criticism!!!!
Thank you again all!
Because your height is always integer value I think it's better to use:
$height = (int) $_POST['height'];
I had a mathematical calculation where I used a wrong operator:
if ($row['gender'] === "m") {
if ($height = 5) { // <------ RIGHT HERE!!!!!
$height_measure = 106 + ($height_dec * 6);
}
So I changed the operator to === and now everything works fine again!!!!