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); ?> Link to comment https://forums.phpfreaks.com/topic/76586-can-somebody-help-me-spot-the-syntax-error-in-the-code-below/ 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 Link to comment https://forums.phpfreaks.com/topic/76586-can-somebody-help-me-spot-the-syntax-error-in-the-code-below/#findComment-387849 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? Link to comment https://forums.phpfreaks.com/topic/76586-can-somebody-help-me-spot-the-syntax-error-in-the-code-below/#findComment-387851 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'] ;";"] Link to comment https://forums.phpfreaks.com/topic/76586-can-somebody-help-me-spot-the-syntax-error-in-the-code-below/#findComment-387854 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'] . "', " . Link to comment https://forums.phpfreaks.com/topic/76586-can-somebody-help-me-spot-the-syntax-error-in-the-code-below/#findComment-387856 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... Link to comment https://forums.phpfreaks.com/topic/76586-can-somebody-help-me-spot-the-syntax-error-in-the-code-below/#findComment-387867 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. Link to comment https://forums.phpfreaks.com/topic/76586-can-somebody-help-me-spot-the-syntax-error-in-the-code-below/#findComment-387869 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.