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

209
Vistas
Output text if the SQL value is empty

I'm trying to output the text 'N/A' into my table if there is an empty value stored for it in my SQL table. Here is what I have so far:

while($rowObj = $queryResult->fetch_object())
                {
                $eventTitle = $rowObj->eventTitle;
                $catDesc = $rowObj->catDesc;
                $catID = $rowObj->catID;
                $eventDescription = $rowObj->eventDescription;
                $venueName = $rowObj->venueName;
                $venueID = $rowObj->venueID;
                $eventStartDate = $rowObj->eventStartDate;
                $eventEndDate = $rowObj->eventEndDate;
                $eventPrice = $rowObj->eventPrice;                  

                echo "
                <tr>
                    <td> $eventTitle </td>
                    <td> " . (empty($catID)) ? 'N/A' : '$catDesc'. "</td>
                    <td> " . (empty($eventDescription)) ? 'N/A' : '$eventDescription'. "</td>
                    <td> " . (empty($venueID)) ? 'N/A' : '$venueName'. "</td>
                    <td> $eventStartDate </td> 
                    <td> $eventEndDate </td>
                    <td> $eventPrice </td>
                </tr>
                    ";
                }
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

if(empty($value)){
    echo "This value is empty";
}

Or if you want to insert a value "into the table" if a field is empty

if(empty($value)){
 $value = "N/A";
 //INSERT QUERY
}
over 4 years ago · Santiago Trujillo Denunciar

0

Try this

$value = empty($value) ? "NA" : $value;

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