I just don't know what to do, and don't know how to search about this weird problem. Here is is:
All the connection on the page are working correctly, just in case:
I Have this code to update an Email on the Database
$fUsername = mysql_real_escape_string($_GET['user']);
$fPassword = mysql_real_escape_string($_GET['senha']);
$fEmail = mysql_real_escape_string($_POST['fEmail']);
$sql = "UPDATE usuario SET email='$fEmail ' WHERE username = '$fUsername' and senha = '$fPassword'";
$result=mysql_query($sql);
Now, the Problem:
This query is not Updating the "Email" field on the BD. It just makes the field empty.
If I echo the $sql var, I get this: UPDATE usuario SET email='teste@gmail.com ' WHERE username = 'teste1' and senha = 'e10adc3949ba59abbe56e057f20f883e'
If I ran manually this query on the mySQL, it updates the field like I want.
If I manually pass a value to the $fEmail var ( $fEmail = "teste@gmail.com" ). It works just fine.
The only way that don't work is when I take the value from the Form .
Does anyone have the solution for this? D:
You are using $_GET
for the username and password, and $_POST
for the email. Check your form
actual submit method, and fix the relevant data fetching.
You should use $_GET['fEmail']
if the form data is being sent via GET. $_POST['fEmail']
is not defined in that case, which would explain the behavior you're seeing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.