Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/10/2008, 17:03
moisesneveu
 
Fecha de Ingreso: octubre-2008
Mensajes: 162
Antigüedad: 15 años, 6 meses
Puntos: 11
Pregunta Auuda porfavor (Juanquillo?)

Hola, queria pedirles una tremenda ayuda.... se podria decir que soy nuevo en dreamweaver y he realizado muy pocas bases de datos con este... pero me ha surgido un problema en una de las bases de datos que quiero crear.
Es una base de datos para la inscripcion de miembros, he creado en Dreamweaver el juego de registros como corresponde, luego el asistente de formulario de insercion de registros, seguí los pasos como corresponden, al final me aparece el formulario, se ve bien pero al usarlo aparece el siguiente mensaje:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/Pueblo, Region, Profesion, `Iglesia Redencion de`, `Fecha de ingreso`, Observac' at line 1

intente cambiando algunos valores, etc.

desde el phpmyadmin puedo insertar datos a la tabla sin problemas, pero desde el formulario es imposible...

aqui dejo el codigo que el Dreamweaver me dio... espero me puedan ayudar...


<?php require_once('Connections/iglesia.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

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']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO miembros_general (`Nombre completo`, Run, `Fecha nacimiento`, Edad, Nacionalidad, `Estado civil`, Direccion, Comuna/Pueblo, Region, Profesion, `Iglesia Redencion de`, `Fecha de ingreso`, Observaciones) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Nombre_completo'], "text"),
GetSQLValueString($_POST['Run'], "int"),
GetSQLValueString($_POST['Fecha_nacimiento'], "date"),
GetSQLValueString($_POST['Edad'], "int"),
GetSQLValueString($_POST['Nacionalidad'], "text"),
GetSQLValueString($_POST['Estado_civil'], "text"),
GetSQLValueString($_POST['Direccion'], "text"),
GetSQLValueString($_POST['ComunaPueblo'], "text"),
GetSQLValueString($_POST['Region'], "text"),
GetSQLValueString($_POST['Profesion'], "text"),
GetSQLValueString($_POST['Iglesia_Redencion_de'], "text"),
GetSQLValueString($_POST['Fecha_de_ingreso'], "int"),
GetSQLValueString($_POST['Observaciones'], "text"));

mysql_select_db($database_iglesia, $iglesia);
$Result1 = mysql_query($insertSQL, $iglesia) or die(mysql_error());

$insertGoTo = "insertado_ok.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}

mysql_select_db($database_iglesia, $iglesia);
$query_insertar = "SELECT * FROM miembros_general";
$insertar = mysql_query($query_insertar, $iglesia) or die(mysql_error());
$row_insertar = mysql_fetch_assoc($insertar);
$totalRows_insertar = mysql_num_rows($insertar);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Nombre completo:</td>
<td><input type="text" name="Nombre_completo" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Run:</td>
<td><input type="text" name="Run" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Fecha nacimiento:</td>
<td><input type="text" name="Fecha_nacimiento" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Edad:</td>
<td><input type="text" name="Edad" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Nacionalidad:</td>
<td><input type="text" name="Nacionalidad" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Estado civil:</td>
<td><input type="text" name="Estado_civil" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Direccion:</td>
<td><input type="text" name="Direccion" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Comuna/Pueblo:</td>
<td><input type="text" name="ComunaPueblo" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Region:</td>
<td><input type="text" name="Region" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Profesion:</td>
<td><input type="text" name="Profesion" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Iglesia Redencion de:</td>
<td><input type="text" name="Iglesia_Redencion_de" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Fecha de ingreso:</td>
<td><input type="text" name="Fecha_de_ingreso" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right" valign="top">Observaciones:</td>
<td><textarea name="Observaciones" cols="50" rows="5"></textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td><input type="submit" value="Insertar registro"></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($insertar);
?>


Bueno he leido mucho y aprendido mucho de este foro sobre todo los minitutoriales que hace JUANQUILLO, ojala que se de cuenta de mi post y que me pueda ayudar tambien... bueno.. me despido y desde ya muchas gracias... saludos.