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

118
Views
No encuentro ningún error. Este código funciona bien. Actualice mis datos perfectamente. Pero aparece 1 error
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); } }

muestra este error:

Tiene un error en su sintaxis SQL; consulte el manual que corresponde a la versión de su servidor MariaDB para obtener la sintaxis correcta para usar cerca de '1' en la línea 1

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Realmente simple, está ejecutando la función de consulta dos veces, es por eso que obtiene 1 .

  • 1 siendo booleano VERDADERO.
  • (MySQL) Literales booleanos

Asi que

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

necesita ser cambiado a solo

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

El primero se ejecuta, y el (if) ! El operador también activará la función de consulta ya que era VERDADERO, como en "(si) no falla".

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

"Para otras consultas exitosas, mysqli_query() devolverá TRUE ".

Parametriza tu consulta también, estás abierto a una inyección de SQL.

  • https://en.wikipedia.org/wiki/Declaración_preparada
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!