jigsawsoul Posted August 14, 2009 Share Posted August 14, 2009 i get this error message: Error in query: INSERT INTO wbl_enquiryrespond (enquiry_id, login_id, enquiryreplydate, enquiryrespond) VALUES (''5 ', '9', '2009.08.15', 'tyjutyu'). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '5 ', '9', '2009.08.15', 'tyjutyu')' at line 1 <?php session_start(); include '../../library/opendb.php'; include '../../library/config.php'; include '../../library/functions/f_login.php'; include '../../library/functions/f_nav.php'; sessionAuthenticate( ); $enquiryid = $_GET['id']; $loginid = $_SESSION['login_id']; $respond = $_POST['respond']; $date = date("Y.m.d"); $query = "INSERT INTO wbl_enquiryrespond (enquiry_id, login_id, enquiryreplydate, enquiryrespond) VALUES (''$enquiryid ', '$loginid', '$date', '$respond')"; $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); exit; if (mysql_query ($query)) { $_SESSION["message"] = '<div class="message mb">Response To Enquiry Has Been Sent.</div>'; header ('Location: list.php'); } else { $_SESSION["message"] = '<div class="error mb">Response To Enquiry Failed.</div>'; header ('Location: list.php'); } include '../../library/closedb.php'; ?> Please Help ! Thanks... Quote Link to comment https://forums.phpfreaks.com/topic/170333-have-an-error-in-your-sql-syntax-help/ Share on other sites More sharing options...
taquitosensei Posted August 15, 2009 Share Posted August 15, 2009 you have an extra single quote before $enquiryid Quote Link to comment https://forums.phpfreaks.com/topic/170333-have-an-error-in-your-sql-syntax-help/#findComment-898551 Share on other sites More sharing options...
Markh789 Posted August 15, 2009 Share Posted August 15, 2009 taquitosensei is correct. $query = "INSERT INTO wbl_enquiryrespond (enquiry_id, login_id, enquiryreplydate, enquiryrespond) VALUES (''$enquiryid ', '$loginid', '$date', '$respond')"; Change it to $query = "INSERT INTO wbl_enquiryrespond (enquiry_id, login_id, enquiryreplydate, enquiryrespond) VALUES ('$enquiryid ', '$loginid', '$date', '$respond')"; Quote Link to comment https://forums.phpfreaks.com/topic/170333-have-an-error-in-your-sql-syntax-help/#findComment-898627 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.