1ra Versión
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
require_once 'conexion.php';
|
||||
if ($conexion->connect_error) {
|
||||
echo json_encode(['success' => false, 'error' => 'Error de conexión']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$data = json_decode(file_get_contents("php://input"), true);
|
||||
$nombre = $data['nombre'] ?? '';
|
||||
$telefono = $data['telefono'] ?? '';
|
||||
|
||||
$stmt = $conexion->prepare("INSERT INTO proveedores (Nombre, Telefono) VALUES (?, ?)");
|
||||
$stmt->bind_param("ss", $nombre, $telefono);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
echo json_encode(['success' => true]);
|
||||
} else {
|
||||
echo json_encode(['success' => false, 'error' => $conexion->error]);
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
$conexion->close();
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user