PHP / MySQLI Syntax Error

0

What happens? I think it's well built, but obviously something is missing.

Name of the Table: citas

Field Name: idcita, horacita, diacita, asuntocita

  

Query Error 1064 You have an error in your SQL syntax; check the   manual that corresponds to your MySQL server version for the right   syntax to use near 'diacita =' 2018-11-14 'casocita =' df 'WHERE idcita   = 22 'at line 1

$fechaBD = $_POST['anio']."-".$_POST['mes']."-".$_POST['dia'];
$horaBD = $_POST['hora'].":".$_POST['min'];

    $modificarQuery = "UPDATE citas SET horacita='".$horaBD."' diacita='".$fechaBD."' asuntocita='".$_POST['asuntoCita']."' WHERE idcita = ".$idCita;

    $result = mysqli_query($conexion, $modificarQuery);

    if(!$result){
                  die("Error de Consulta ".mysqli_errno($conexion)." ".mysqli_error($conexion));
    
asked by Tygreton 14.11.2018 в 15:17
source

1 answer

2

Yes, it is well formed, but you lack commas between each of the parameters that you pass to the query. The formation of update is the following:

UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value

Adding the commas, it should work, unless you have a column that does not correspond to the table.

    
answered by 14.11.2018 в 15:22