Please i’m going nuts on this thing.
I have this form:
echo "<input type='text' name='user_id' value='".$id."'' />";
echo "<tr><td>Emer</td><td><input type='text' name='first_name' value='".$rows['first_name']."' /></td></tr>";
echo "<tr><td>Mbiemer</td><td><input type='text' name='last_name' value='".$rows['last_name']."'' /></td></tr>";
echo "<tr><td>Mosha</td><td><input type='text' name='age' value='".$rows['age']."' /></td></tr>";
echo "<tr><td>Nr.Telefoni (Nr. i telefonit duhet te jete i formatit 06* ** *** **)</td><td><input type='text' name='phone' value='".$rows['phone']."' /></td></tr>";
echo "<tr><td>E-mail</td><td><input type='text' size='25' name='email' value='".$rows['Email']."' /></td></tr>";
echo "<tr><td>Qyteti</td><td><input type='text' size='25' name='city' value='".$rows['city']."' /></td></tr>";
echo "<tr><td>Shteti</td><td><input type='text' size='25' name='country' value='".$rows['country']."' /></td></tr>";
The update code:
$first_name= $_POST['first_name'];
$last_name= $_POST['last_name'];
$mosha= $_POST['age'];
$phone=$_POST['phone'];
$email= $_POST['email'];
$city = $_POST['city'];
$country = $_POST['country'];
$id = $_POST['user_id'];
$query = "UPDATE users SET first_name = '$first_name',last_name = '$last_name',age = '$mosha',phone = '$phone',Email = '$email',country = '$country',city = '$city' WHERE user_id = '$id' ";
mysql_query($query) or die ("Error in query: $query");
;
If i echo it i get this:
UPDATE users SET first_name = 'Al',last_name = 'M',age = '22',phone = '3545435345',Email = 'albana@al.com',country = 'Albania',city = 'Tirana' WHERE user_id = '1'
Then the issue is, i go back to the page where i have all users and the phone number there displays something totally different, it’s like a fixed number.
Please help me where i’m going wrong!
Is driving me nuts.
The query:
$sql='SELECT * FROM users WHERE Active = 1 AND user_id="'.$id.'"';
$result = mysql_query($sql) or die($sql."<br/><br/>".mysql_error());
Phone number is integer type.
if it displays as
2147483647, then it’ll be the data type problem use varchar(10) if the phone number starts with 0 or + otherwise use bigint