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

112
Vistas
I don't find any error.this code doing well.update my data perfectly.but 1 error is showing
if ($_SERVER["REQUEST_METHOD"]=="POST") {
            $updatedate=$_POST['date'];
            $updateday=$_POST['day'];
            $updateplace=$_POST['place'];
            $updatehighlight=$_POST['highlight'];
            $updatediscription=$_POST['discription'];
            $sqlupdate="UPDATE $tableselect SET entrydate='$updatedate',day='$updateday',place='$updateplace',highlight='$updatehighlight',discription='$updatediscription' WHERE id ='$getid'";
            $sqlquery=mysqli_query($db,$sqlupdate);
            if (!mysqli_query($db,$sqlquery)) {
                    echo "error " .$sqlquery. "<br>" . mysqli_error($db);
                }
        }

it showing this error:

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1' at line 1

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Real simple, you're running the query function twice, that's why you're getting 1.

  • 1 being boolean TRUE.
  • (MySQL) Boolean Literals

So

$sqlquery=mysqli_query($db,$sqlupdate);
            if (!mysqli_query($db,$sqlquery)) {...}

needs to be changed to just

$sqlquery=mysqli_query($db,$sqlupdate);
            if(!$sqlquery){...}

The first gets executed, and the (if)! operator will also trigger the query function since it was TRUE, as in "(if)not failing".

  • http://php.net/manual/en/mysqli.query.php

"For other successful queries mysqli_query() will return TRUE."

Parametrize your query also, you're open to an SQL injection.

  • https://en.wikipedia.org/wiki/Prepared_statement
about 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