$_POST['identificador'],
"marca" => $_POST['marca'],
"modelo" => $_POST['modelo'],
"matricula" => $_POST['matricula']
];
$sql = "UPDATE vehiculos
SET identificador = :identificador,
marca = :marca,
modelo = :modelo,
matricula = :matricula
WHERE identificador = :identificador";
$statement = $connection->prepare($sql);
$statement->execute($vehiculo);
} catch(PDOException $error) {
echo $sql . "
" . $error->getMessage();
}
}
if (isset($_GET['identificador'])) {
try {
$connection = new PDO($dsn, $username, $password, $options);
$identificador = $_GET['identificador'];
$sql = "SELECT * FROM vehiculos WHERE identificador = :identificador";
$statement = $connection->prepare($sql);
$statement->bindValue(':identificador', $identificador);
$statement->execute();
$vehiculo = $statement->fetch(PDO::FETCH_ASSOC);
} catch(PDOException $error) {
echo $sql . "
" . $error->getMessage();
}
} else {
echo "¡Algo ha salido mal!";
exit;
}
?>
successfully updated.