Hi, i'm trying to allow a logged in member to be able to see and edit/update their details. Using two pages, modify_user.php and do_modify_user.php to do this, but the second page is giving me an error saying that the query was empty (!)- well it says the following:
Error
Your details were not updated successfully due to a system error, please go back and try again.
Query was empty
Query:
and thats it!
The code for do_modify_user.php is as follows;
<?php
session_start();
include('login.functions.php');
check_user();
$user = $_SESSION['valid_user'];
require_once('connection.php');
$first_name = $_POST["updateFirstName"];
$last_name = $_POST["updateLastName"];
$gender = $_POST["updateGender"];
$email_address = $_POST["updateEmail"];
$address = $_POST["updateAddress"];
$dob = $_POST["updateDOB"];
$query_update = mysql_query("UPDATE member SET first_name = ".$first_name.", last_name = ".$last_name.", gender = ".$gender.", address_line_one = ".$address.", dob = ".$dob." WHERE email_address = '{$user}'");
$update_result = mysql_query($query_update);
if($update_result) { // if update was successful,
echo '<h2 id="mainhead">Thank you!</h2>
<p>Your details were updated successfully.</p>
<p><a href="admin_home.php">Back to Administrator Home></p>';
}
else { // if it did not insert ok
echo '<h2 id="mainhead">Error</h2>
<p class="error">Your details were not updated successfully due to a system error, please go back and try again.</p>';
echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query_update . '</p>'; // debugging message
}
?>
Any ideas what I'm doing wrong? If the modify_user.php code is needed I can paste that also.
Thanks for any help, I'm new to this stuff and its hopefully something really obvious I've done causing the query to be empty, but I can't see what 🙁
cheers!