pls help me fix the error. What and where is the problem?
Thanks for the help!


Here is the error message >>

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 ' )' at line 23

And this is the php code >>

<? ob_start(); ?>
<?php require_once("includes/session.php");?>
<?php require_once("includes/connection.php");?>
<?php require_once("includes/functions.php");?> 




<?php
 if(isset($_POST['submit'])) {
	 
	 $id = "";
	 $bookDate = mysql_prep(date("Y-d-m"));
	 $bookTime = mysql_prep(strftime("%H:%M:%S", time()));
	 $requestBy = mysql_prep($_SESSION['fname']);
	 $applicantId = mysql_prep($_SESSION['idnum']);	
	 
	 $subjectName = mysql_prep($_POST['subjectName']);
	 $subjectCode = mysql_prep($_POST['subjectCode']);
	 $subjectOverview = mysql_prep($_POST['subjectOverview']);
	 $destination = mysql_prep($_POST['destination']);
	 $expectedParticipants = mysql_prep($_POST['expectedParticipants']);
	 $prefDate = mysql_prep($_POST['date']);
	 $tourObjectives = mysql_prep($_POST['tourObjectives']);
	 $seminarTopic = mysql_prep($_POST['seminarTopic']);
	 $speaker = mysql_prep($_POST['speaker']);
	 $serviceClass = mysql_prep($_POST['serviceClass']);
	 $activities = mysql_prep($_POST['activities']);
	 $participantsBudget = mysql_prep($_POST['participantsBudget']);
	 $additionalConcern = mysql_prep($_POST['additionalConcern']);

	 
				
	$query = "INSERT INTO `hatsdb`.`tbl_tour_request` (
`request_id` ,
`subject_name` ,
`subject_code` ,
`subject_overview` ,
`destination` ,
`expected_num_participants` ,
`prefDate` ,
`tour_objectives` ,
`seminar_topic` ,
`seminar_speaker` ,
`service_classification` ,
`activities` ,
`budget_per_student` ,
`additionalConcern` ,
`request_by` ,
`applicant_id` ,
`bookingDate` ,
`bookingTime`
)
VALUES (
				'{$id}','{$subjectName}', {$subjectCode}, '{$subjectOverview}', {$expectedParticipants},{$prefDate},'{$tourObjectives}','{$seminarTopic}','{$speaker}','{$serviceClass}','{$activities}',{$participantsBudget}, '{$requestBy}' , '{$applicantId}'
				'{$additionalConcern}', '{$requestBy}' , '{$applicantId}',{$bookingDate},{$bookingTime}
			)";

	$result = mysql_query($query);
	if ($result) {
		$message = " Success! "; 
		redirect_to("about.php");

	} else {
		// Display error message.
		$message = "<p>Failed.</p>";
		$message .= "<p>" . mysql_error() . "</p>";
	}




 }
 else{
	 
	$message = "ERROR". mysql_error(); 
 }
?>


<?php if(!empty($message)) { echo "<label><p>{$message}</p></label> "; } ?> <br />

<? ob_flush(); ?>

Thanks

pls help me fix the error. What and where is the problem?
Thanks for the help!

you need a comma , in between '{$applicantId}' and '{$additionalConcern}'

other code...'{$applicantId}', '{$additionalConcern}'...other code

oh, that is on lines 55 and 56 of the above script. line 23 is where the error is in your actual query that you are sending.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.