Foros del Web » Creando para Internet » Herramientas y Software »

Auuda porfavor (Juanquillo?)

Estas en el tema de Auuda porfavor (Juanquillo?) en el foro de Herramientas y Software en Foros del Web. 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 ...
  #1 (permalink)  
Antiguo 21/10/2008, 17:03
 
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.
  #2 (permalink)  
Antiguo 21/10/2008, 20:05
Avatar de nicolyto77  
Fecha de Ingreso: marzo-2007
Ubicación: Buenos Aires
Mensajes: 782
Antigüedad: 17 años, 1 mes
Puntos: 12
De acuerdo Respuesta: Auuda porfavor (Juanquillo?)

Hola que tal?

Por casualidad, ¿que version de DW usas?

Otra cosa, vos tocaste algo del codigo? Lo que veo raro ahi es esto:

Código PHP:
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)"
Proba momentaneamente, sacar la BARRA '/' esa en Comuna/Pueblo, y dejalo asi:

Código PHP:
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, ComunaPueblo, Region, Profesion, `Iglesia Redencion de`, `Fecha de ingreso`, Observaciones) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
Despues si continua el error, vemos que mas puede ser.

Saludos y Suerte
__________________
CabaSoft Networks
  #3 (permalink)  
Antiguo 24/10/2008, 17:26
Avatar de juaniquillo
Colaborador
 
Fecha de Ingreso: noviembre-2005
Ubicación: San Juan, Puerto Rico
Mensajes: 5.745
Antigüedad: 18 años, 5 meses
Puntos: 281
Respuesta: Auuda porfavor (Juanquillo?)

lo que me parece raro es que los campos de tu base de datos se llamen:
Cita:
Nombre completo`, Run, `Fecha nacimiento`, Edad, Nacionalidad, `Estado civil`, Direccion, Comuna/Pueblo, Region, Profesion, `Iglesia Redencion de`, `Fecha de ingreso`, Observaciones
No se como te dejaron nombrar un campo usando espacios o usando un 'slash' como en el caso de 'Comuna/Pueblo'
__________________
Por fin.. tengo algo parecido a un blog
Y por lo visto ya estoy escribiendo...
  #4 (permalink)  
Antiguo 27/10/2008, 17:12
 
Fecha de Ingreso: octubre-2008
Mensajes: 162
Antigüedad: 15 años, 6 meses
Puntos: 11
De acuerdo Muchas gracias..

Bueno muchas gracias por tu interes en ayudarme... bueno uso el dreamweaver 8 en español, y bueno cometí el gran error al escribir en el mysql por medio del phpmyadmin un valor que no es aceptado , yo puse... "comuna/pueblo", ahora esta "comuna o pueblo" y funciono perfecto, lo demas del codigo lo deje tal cual. yo no sabia por mi inexperiencia que el slash no era aceptado....

Bueno mis agradecimientos inmensos a nicolyto77 y a Juanquillo por la ayuda.... y lo atentos que son .... gracias... y saludos.

Última edición por moisesneveu; 27/10/2008 a las 17:17
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 15:29.