h3rm1t9536
asked on
PHP syntax error T_CONSTANT_ENCAPSED_STRING
Hi All,
I have a PHP site that displays reports from stored procedures in SQL. I use a dev to do the site work for me and after a change the site is not working.
The error that now comes up is
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in D:\inetpub\wwwroot\reporti ng\src\php \reports.p hp on line 331
Line 331 of reports.php reads.
report->DaysOverdue = '<span style="color: green;">'.$report->DaysOve rdue-30.'< /span>';
The dev added a function to remove 30 from the value of the results in this column. I suspect that's whats broken it but I can't get hold of him for a few days so any help would be appreciated.
Thanks
H
I have a PHP site that displays reports from stored procedures in SQL. I use a dev to do the site work for me and after a change the site is not working.
The error that now comes up is
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
Line 331 of reports.php reads.
report->DaysOverdue = '<span style="color: green;">'.$report->DaysOve
The dev added a function to remove 30 from the value of the results in this column. I suspect that's whats broken it but I can't get hold of him for a few days so any help would be appreciated.
Thanks
H
ASKER
Hi Radek,
So to be clear (remember I have no knowledge of PHP !) I'm simply adding a \ in two places?
So to be clear (remember I have no knowledge of PHP !) I'm simply adding a \ in two places?
yes
ASKER
OK. Tried that, same error unfortunately.
aaah, no
sorry
you just omiited $ at the beginning. forget the slashes.
$report->DaysOverdue = '<span style="color: green;">'.$report->DaysOve rdue-30.'< /span>';
sorry
you just omiited $ at the beginning. forget the slashes.
$report->DaysOverdue = '<span style="color: green;">'.$report->DaysOve
ASKER
Apologies, it does have a $ at the beginning already. I somehow didn't paste that in.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
did it help ?
ASKER
I am having to wait for a dev to look at that as its beyond my capabilities. I will feedback as soon as its been tried.
You need a professional PHP developer to help you here. The "quick change" your developer provided should have been tested, and obviously was not. My guess is that you have a requirement for more than one line of changes. The PHP parser will stop after the first parse error. If the "quick change" involved more than one line, there may be more than one error!
I would consider this step as a way to start the testing process (but it's a process, and may require more than one step). And this step "mungs" the DaysOverdue property in the $report object, so it's a patch but may have downstream effects that we cannot know by looking at one line of PHP code.
$x = $report->DaysOverdue - 30;
$report->DaysOverdue = '<span style="color: green;">' . $x . '</span>';
I would consider this step as a way to start the testing process (but it's a process, and may require more than one step). And this step "mungs" the DaysOverdue property in the $report object, so it's a patch but may have downstream effects that we cannot know by looking at one line of PHP code.
$x = $report->DaysOverdue - 30;
$report->DaysOverdue = '<span style="color: green;">' . $x . '</span>';
ASKER
A developer solved it in the end.
$report->DaysOverdue = '<span style="color: green;">'.($report->DaysOv erdue-30). '</span>';
Thanks for the help.
$report->DaysOverdue = '<span style="color: green;">'.($report->DaysOv
Thanks for the help.
well it sounds like exactly mine solution but it's your call ofkz :D
report->DaysOverdue = '<span style=\"color: green;\">'.$report->DaysOverdue-3