未捕获的 PDOException:SQLSTATE[HY000]:一般错误:25 列索引超出范围

时间:2021-01-25 15:07:23

标签: php sqlite

我快疯了,因为在所有网站中他们都出现了这个错误,但我找不到解决方案......

有人可以帮我吗?

require_once 'conn.php';

if(ISSET($_POST['update'])){
    $id = $_POST['id'];
    $fecha = $_POST['Fecha'];
    $num_aviso = $_POST['num_aviso'];
    $horainicio = $_POST['horainicio'];
    $horafin = $_POST['horafin'];
    $entidad = $_POST['entidad'];
    $direccion = $_POST['direccion'];
    $poblacion = $_POST['poblacion'];
    $usuario = $_POST['usuario'];
    
    $query = "UPDATE cierres SET fecha = '".$_POST['Fecha']."', num_aviso = ".$_POST['num_aviso'].", horainicio = '".$_POST['horainicio']."', horafin = '".$_POST['horafin']."', entidad = '".$_POST['entidad']."', direccion = '".$_POST['direccion']."', poblacion = '".$poblacion = $_POST['poblacion']."', usuario = '".$_POST['usuario']."' WHERE id = ".$_POST['id'];
    
    
    echo($query);
    $stmt = $conn->prepare($query);
    $stmt->bindParam(':id', $id);
    $stmt->bindParam(':Fecha', $fecha);
    $stmt->bindParam(':num_aviso', $num_aviso);
    $stmt->bindParam(':horainicio', $horainicio);
    $stmt->bindParam(':horafin', $horafin);
    $stmt->bindParam(':entidad', $entidad);
    $stmt->bindParam(':direccion', $direccion);
    $stmt->bindParam(':poblacion', $poblacion);
    $stmt->bindParam(':usuario', $usuario);
    
    $stmt->execute();
    $conn = null;
    
    header('location: index.php');
    
}

当我运行它时,我收到错误:

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 25 column index out of range

0 个答案:

没有答案
相关问题