Geg1
Kappa
Verificación en dos pasos activada
Verificado por Whatsapp
¡Ha verificado su Paypal!
Verificado por Binance
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Garofalo, direccion=Av Libertador 879, telefono=4832658 WHERE id_cliente=2' at line 1
Me sale ese error al querer actualizar un registro mediante un formulario en PHP, el cual es este:
PHP:
<?php
mysql_pconnect("localhost", "root", "");
mysql_select_db("gestorpedidos");
mysql_query("SET NAMES 'utf8'");
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE clientes SET nombre=%s, direccion=%s, telefono=%s WHERE id_cliente=%s", $_POST['nombre'], $_POST['direccion'], $_POST['telefono'], $_POST['id_cliente']);
$Result1 = mysql_query($updateSQL) or die(mysql_error());
$updateGoTo = "gestioncliente.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$modif_cliente_editarcliente = "0";
if (isset($_GET['editarcliente'])) {
$modif_cliente_editarcliente = $_GET['editarcliente'];
}
$query_editarcliente = sprintf("SELECT * FROM clientes WHERE clientes.id_cliente = %s", $modif_cliente_editarcliente);
$editarcliente = mysql_query($query_editarcliente) or die(mysql_error());
$row_editarcliente = mysql_fetch_assoc($editarcliente);
$totalRows_editarcliente = mysql_num_rows($editarcliente);
$query_clientes = "SELECT * FROM clientes ORDER BY id_cliente ASC";
$clientes = mysql_query($query_clientes) or die(mysql_error());
$row_clientes = mysql_fetch_assoc($clientes);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="estilos.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<title>Gestion de Clientes / Editar Cliente</title>
</head>
<body>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Nombre:</td>
<td><input type="text" name="nombre" value="<?php echo htmlentities($row_editarcliente['nombre'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Direccion:</td>
<td><input type="text" name="direccion" value="<?php echo htmlentities($row_editarcliente['direccion'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Telefono:</td>
<td><input type="text" name="telefono" value="<?php echo htmlentities($row_editarcliente['telefono'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Actualizar Datos de Cliente"></td>
</tr>
</table>
<input type="hidden" name="id_cliente" value="<?php echo $row_editarcliente['id_cliente']; ?>">
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="id_cliente" value="<?php echo $row_editarcliente['id_cliente']; ?>">
</form>
<p> </p>
</body>
</html>
</body>
</html>
<?php
mysql_free_result($editarcliente);
?>
No encuentro el error sinceramente, disculpen, es que soy nuevo en estos temas