0

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

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by ddymacek
0

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

0

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

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

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.