Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

T_CONSTANT_ENCAPSED_STRING Errors

Status
Not open for further replies.

axsom1

Technical User
Feb 27, 2001
67
US
Does anyone notice why I am getting the following error with the code below:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in D:\Web Sites\safety\queries\emerg.query.php on line 23 (marked below with '-->')

Code:
<?

//Report Title
$title = "Emergency Preparedness";

//Define text we do not want to input
$rem_dissum = "Please summarize what the staff needs to know to prepare for the upcoming drill.";
$rem_prepsum = "Please provide a summary of what was talked about at the meeting.";
$rem_staff = "Friendly reminders, things to look out for, etc...";

//Query
$rptdate = $_REQUEST["rptdate"];
$dis_drill = addslashes(trim($_REQUEST["dis_drill"]));
$dis_sum = addslashes(chop(str_replace($rem_dissum,'',$_REQUEST["fire_nar"])));
$prep_sum = addslashes(chop(str_replace($rem_prepsum,'',$_REQUEST["prep_sum"])));
$msg_staff = addslashes(chop(str_replace($rem_staff,'',$_REQUEST["msg_staff"])));

$query = "INSERT INTO emerg_prep 
	(rptdate, dis_date, dis_drill, dis_sum, prep_date, prep_sum, msg_staff) 
	VALUES (
	'".$rptdate."',
	'".$_REQUEST["drill_year"]."-".$_REQUEST["drill_month"]."-".$_REQUEST["drill_day"]"',
-->	'".$dis_drill."',
	'".$dis_sum."',
	'".$_REQUEST["com_year"]."-".$_REQUEST["com_month"]."-".$_REQUEST["com_day"]"',
	'".$prep_sum."',
	'".$msg_staff."'
	)";

?>

Any help is appreciated...just think I need some fresh eyes on it.

Thanks,
John
 
There must be some problem with the string concatination.

The strings need to be concatinated marked red below.
Code:
<?

//Report Title
$title = "Emergency Preparedness";

//Define text we do not want to input
$rem_dissum = "Please summarize what the staff needs to know to prepare for the upcoming drill.";
$rem_prepsum = "Please provide a summary of what was talked about at the meeting.";
$rem_staff = "Friendly reminders, things to look out for, etc...";

//Query
$rptdate = $_REQUEST["rptdate"];
$dis_drill = addslashes(trim($_REQUEST["dis_drill"]));
$dis_sum = addslashes(chop(str_replace($rem_dissum,'',$_REQUEST["fire_nar"])));
$prep_sum = addslashes(chop(str_replace($rem_prepsum,'',$_REQUEST["prep_sum"])));
$msg_staff = addslashes(chop(str_replace($rem_staff,'',$_REQUEST["msg_staff"])));

$query = "INSERT INTO emerg_prep 
    (rptdate, dis_date, dis_drill, dis_sum, prep_date, prep_sum, msg_staff) 
    VALUES (
    '".$rptdate."',
    '".$_REQUEST["drill_year"]."-".$_REQUEST["drill_month"]."-".$_REQUEST["drill_day"][COLOR=red].[/color]"','".$dis_drill."',
    '".$dis_sum."',
    '".$_REQUEST["com_year"]."-".$_REQUEST["com_month"]."-".$_REQUEST["com_day"][COLOR=red].[/color]"',
    '".$prep_sum."',
    '".$msg_staff."'
    )";

?>




--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
As spookie points out:
All parts of a concatenated string have to be "fused" together by the concatenation operator, which is the dot (.)
Any missing such operator produces the error you encounter. The error is also on or before (!) the line number PHP spits out.
Code:
# wrong
$str = "Blah Blah"',';
# correct
$str = "Blah Blah".',';
 
Thanks guys!

I knew it was something simple...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top