Cita:
Iniciado por GatorV
Pues con ese código solamente estas haciendo un echo del INSERT, tienes que realizar el insert usando mysql_query, no solamente imprimirlo en pantalla...
Perdona, asi tampoco me funciona:
Código PHP:
Ver original<?php require_once('Connections/conexion.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ?
intval($theValue) : "NULL"; break;
case "double":
$theValue = ($theValue != "") ?
doubleval($theValue) : "NULL"; break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); }
$id_aviso=$_POST['id_aviso'];
$localidad = $_POST['localidad'];
$provincia= $_POST['provincia'];
$calle = $_POST['calle'];
$numero = $_POST['numero'];
$edificio= $_POST['edificio'];
$puerta = $_POST['puerta'];
$piso = $_POST['piso'];
$letra= $_POST['letra'];
$email = $_POST['email'];
$NUM_DIR = $_POST['NUM_DIR'];
$total = count($localidad); for ($i = 0; $i < $total; $i++) {
$local = $localidad[$i];
$prov = $provincia[$i];
$call = $calle[$i];
$nume = $numero[$i];
$edif = $edificio[$i];
$puer = $puerta[$i];
$pis = $piso[$i];
$letr = $letra[$i];
$emai = $email[$i];
$insertSQL = sprintf("INSERT INTO dir_usuarios (local,prov,call,nume,edif,puer,pis,letr,emai,id_aviso,NUM_DIR)VALUES (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s)", GetSQLValueString($_POST['local'], "text"),
GetSQLValueString($_POST['prov'], "text"),
GetSQLValueString($_POST['call'], "text"),
GetSQLValueString($_POST['nume'], "text"),
GetSQLValueString($_POST['edif'], "text"),
GetSQLValueString($_POST['puer'], "text"),
GetSQLValueString($_POST['pis'], "text"),
GetSQLValueString($_POST['letr'], "text"),
GetSQLValueString($_POST['emai'], "text"),
GetSQLValueString($_POST['id_aviso'], "int"),
GetSQLValueString($_POST['NUM_DIR'], "text"));
}
$query_usuarios = "SELECT *
FROM usuarios WHERE id_aviso='$id_aviso'";
$query_Recordset2 = "SELECT * FROM dir_usuarios where id_aviso='$id_aviso' AND NUM_DIR='1'";
?>
Me da error:
Código HTML:
Ver originalYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'call,nume,edif,puer,pis,letr,emai,id_aviso,NUM_DIR)VALUES (NULL, NULL, NULL, NUL' at line 1