SyntaxError: unterminated string literal error

Clash Royale CLAN TAG#URR8PPPSyntaxError: unterminated string literal error
I found error like this
SyntaxError: unterminated string literal
description: '<div><span class="cal-tar">Patient NationalId :</span> 4376
is anything mistake in this
if (count($doctor_dates) > 0) {
foreach ($doctor_dates as $doctor_date) {
?>
{
id: '<?php echo $doctor_date->bookingRef; ?>',
title: '<?php echo $doctor_date->name; ?>',
description: '<?php
echo nl2br('<div><span class="cal-tar">Patient NationalId :</span> ' . $doctor_date->nationalID . '</div>');
echo nl2br('<div><span class="cal-tar">Patient Name : </span>' . $doctor_date->bkPatientName . '</div>');
echo nl2br('<div><span class="cal-tar">Patient Mobile :</span> ' . $doctor_date->bkPatientMobilePrefix . '-' . $doctor_date->bkPatientMobileNumber . '</div>');
echo nl2br('<div><span class="cal-tar">Reason:</span> ' . $doctor_date->reason . '</div>');
?>',
start: '<?php echo date('F j Y', strtotime($doctor_date->bookingDate)) . ' ' . $doctor_date->startBookingSlot; ?>',
end: '<?php echo date('F j Y', strtotime($doctor_date->bookingDate)) . ' ' . $doctor_date->endBookingSlot; ?>',
allDay: false, // will make the time show
backgroundColor: '<?php echo ($doctor_date->colorCode != '') ? $doctor_date->colorCode : ''; ?>',
className: 'appnt-slot'
//only need one item in the array, because with the while loop, this will repeat until all the posts are added.
},
<?php
}
}
Iam not getting error syntax error, but i got error syntax literal in console
'
'<?php echo nl2br('<div><span class="cal-tar">Patient NationalId :</span> '
'<?php echo nl2br('<div><span class="cal-tar">Patient NationalId :</span> '
Possible duplicate of When to use double or single quotes in JavaScript?
– freedomn-m
12 mins ago
can u explain briefly in answer
– Nadh
9 mins ago
1 Answer
1
The Problem is that ' is breaking your code.
'
if you ran this code: '<?php echo nl2br('<div><span class="cal-tar">Patient NationalId :</span> ' it would atually only return '<?php echo nl2br(' the rest would return an error because the browser would believe it to be code.
'<?php echo nl2br('<div><span class="cal-tar">Patient NationalId :</span> '
'<?php echo nl2br('
You have to break the ' by using .
'
Your final code would look something like this, but can't promise I've found them all.
if (count($doctor_dates) > 0) {
foreach ($doctor_dates as $doctor_date) {
?>
{
id: '<?php echo $doctor_date->bookingRef; ?>',
title: '<?php echo $doctor_date->name; ?>',
description: '<?php
echo nl2br('<div><span class="cal-tar">Patient NationalId :</span> . $doctor_date->nationalID . </div>');
echo nl2br('<div><span class="cal-tar">Patient Name : </span> . $doctor_date->bkPatientName . </div>');
echo nl2br('<div><span class="cal-tar">Patient Mobile :</span> . $doctor_date->bkPatientMobilePrefix . '-' . $doctor_date->bkPatientMobileNumber . </div>');
echo nl2br('<div><span class="cal-tar">Reason:</span> . $doctor_date->reason . </div>');
?>',
start: '<?php echo date('F j Y', strtotime($doctor_date->bookingDate)) . ' . $doctor_date->startBookingSlot; ?>',
end: '<?php echo date('F j Y', strtotime($doctor_date->bookingDate)) . ' . $doctor_date->endBookingSlot; ?>',
allDay: false, // will make the time show
backgroundColor: '<?php echo ($doctor_date->colorCode != '') ? $doctor_date->colorCode : ''; ?>',
className: 'appnt-slot'
//only need one item in the array, because with the while loop, this will repeat until all the posts are added.
},
<?php
}
}
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
maybe because you are using multiple
'and that breaks your string'<?php echo nl2br('<div><span class="cal-tar">Patient NationalId :</span> ', try'<?php echo nl2br('<div><span class="cal-tar">Patient NationalId :</span> '– Carsten Løvbo Andersen
13 mins ago