Jump to content

have an error in your SQL syntax HELP


jigsawsoul

Recommended Posts

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...

Link to comment
https://forums.phpfreaks.com/topic/170333-have-an-error-in-your-sql-syntax-help/
Share on other sites

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')";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.