Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

292
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

0

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

"<a href=\".......\">"
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda