Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

295
Views
PHP: Unexpected 'StringLiteral'. Expected ','

I get this error notice in the VS code Unexpected 'StringLiteral'. Expected ',' with the PHP code below. Please help me understand what is wrong in it. I see this error with the line beginning with Click to..

while ($dbh->next_record()) {
    $tracker_info = json_decode($dbh->Record['tracker_info'], TRUE);
    inform_sl_operations("PO$dbh->Record['po_number'] needs Follow Up. Due: $dbh->Record['alert'] \n" 
        . " Click to <a href="'search_results.php?po_number=$dbh->Record['po_number']'">view order</a>,"
        . " service@pmm.com", "PO $dbh->Record['po_number'] needs Follow Up");
}
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Using " inside quotes, like:

$string = "href="example.com"";

Is wrong and needs to be escaped, like:

$string = "href=\"example.com\"";

Another possible mistake, don't do:

$string = "$dbh->Record['po_number']";

Store in variable then use, like:

$po_number = $dbh->Record['po_number'];
$string = " ... $po_number ... ";

Try something like:

while ($dbh->next_record()) {
    $tracker_info = json_decode($dbh->Record['tracker_info'], TRUE);

    $num = $dbh->Record['po_number'];
    $alert = $dbh->Record['alert'];

    inform_sl_operations("PO $num needs Follow Up. Due: $alert \n" 
        . " Click to <a href=\"search_results.php?po_number=$num\">view order</a>,"
        . " service@pmm.com", "PO $num needs Follow Up");
}
over 4 years ago · Santiago Trujillo Report

0

You need to escape the double quotes in the href attribute of the <a>

"<a href=\".......\">"
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!