solvinia Posted November 8, 2007 Share Posted November 8, 2007 <?php if (isset($_POST['submit']) && $_POST['submit'] == "Update") { $query_update = "UPDATE agent SET " . "firstName = '" . $_POST['firstName'] . "', " . "surname = '" . $_POST['surname'] . "', " . "email = '" . $_POST['email'] . "', " . "mobileNo = '" . $_POST['mobileNo'] . "', " . "otherNo = '" . $_POST['otherNo'] . "', " . "Dob = '" . $_POST['Dob'] . "', " . "WHERE username = '" . $_SESSION['user_logged'] ' "'. "AND password = '" .$_SESSION['user_password'] ;";" $result_update = mysql_query($query_update) or die(mysql_error()); $query = "SELECT * FROM agent " . "WHERE username = '" . $_SESSION['user_logged'] . "' " . "AND password = (PASSWORD('" . $_SESSION['user_password'] . "'))"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); ?> Quote Link to comment Share on other sites More sharing options...
Orio Posted November 8, 2007 Share Posted November 8, 2007 Put the code in [code ] tags, give us the error and the line it says it is... Dont simply paste it here. Orio Quote Link to comment Share on other sites More sharing options...
SilveR316 Posted November 8, 2007 Share Posted November 8, 2007 Could it be you are not closing your IF tag? Quote Link to comment Share on other sites More sharing options...
solvinia Posted November 8, 2007 Author Share Posted November 8, 2007 apparently the error is anywhere after the where clause [$query_update = "UPDATE agent SET " . "firstName = '" . $_POST['firstName'] . "', " . "surname = '" . $_POST['surname'] . "', " . "email = '" . $_POST['email'] . "', " . "mobileNo = '" . $_POST['mobileNo'] . "', " . "otherNo = '" . $_POST['otherNo'] . "', " . "Dob = '" . $_POST['Dob'] . "', " . "WHERE username = '" . $_SESSION['user_logged'] ' "'. "AND password = '" .$_SESSION['user_password'] ;";"] Quote Link to comment Share on other sites More sharing options...
SilveR316 Posted November 8, 2007 Share Posted November 8, 2007 You have a comma after the Dob part of your query. Remove it. "Dob = '" . $_POST['Dob'] . "', " . Quote Link to comment Share on other sites More sharing options...
solvinia Posted November 8, 2007 Author Share Posted November 8, 2007 i have removed the comma and this query just wont update my mysql table, can somebody please help... Quote Link to comment Share on other sites More sharing options...
SilveR316 Posted November 8, 2007 Share Posted November 8, 2007 Echo out the query with all the variables in it after you set it, then post it. It'll be easier to spot the problem if we see the exact query being fed in to the database. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.