I have a situation where I have to add a phone number to the database.
If I enter number something like: 868150705
It goes OK to database
If I enter something like this: 3706150705
It goes to database with value 2147483647
With this input I take the value out of form
<input type="text" class="demoInputBox" maxlength="20" name="telefonas" value="<?php if(isset($info['tel_nr'])) echo $info['tel_nr']; ?>">
And with this query I put it into database (I have the $username
)
$telnr = $_POST['telefonas'];
$db_handle = new mysqli("localhost", "root", "xxx", "Database");
$query = "UPDATE table SET tel_nr = '$telnr' WHERE username = '$username'";
$result = $db_handle->query($query);
My field tel_nr has the below format:
tel_nr int(20)
Can you help me with this strange magic? Btw I know this code is unsafe but the project isn't live at the moment. Just test things.