Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

296
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

0

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

"<a href=\".......\">"
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda