Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/07/2009, 14:18
mosheyanuv
 
Fecha de Ingreso: julio-2009
Mensajes: 7
Antigüedad: 14 años, 9 meses
Puntos: 0
Exclamación Ayuda con mi tesis

Buenas tengo que entregar mi tesis y tengo un problema, tengo que crear una pagina web sencilla con una base de datos, ahora bien me decidi a crear un formulario que tenga Nombre Apellido Email y Comentarios y que al darle enviar me guarde estos datos en la tabla que cree en base de datos de mi hosting gratuito.

Pero entonces cuando lo pruebo me dice este error: 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 'password'Prueba')' at line 2

Ahora bien dode dice PRUEBA es el mensaje que se escribe en el area de texto en el formulario correspondiente al formulario y donde dice password es el password de mi base de datos.

No entiendo que significa este error ni porque ahora bien aqui os dejo los 2 codigos

CODIGO DE FORMULARIO.php
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
<style type="text/css">
<!--
body {
background-color: #181818;
}
#apDiv1 {
position:absolute;
left:9px;
top:11px;
width:314px;
height:341px;
z-index:1;
}
body,td,th {
color: #FFFFFF;
}
.Estilo1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
}
-->
</style></head>

<body>


<div id="apDiv1"><form name="webtaller" action="insertar_datos.php" method="post">
<div align="center" class="Estilo1">
<p align="left"><strong>Nombre:
**
<input name="Nombre" type="text" size="24" maxlength="24">
</strong></p>
<p align="left"><strong>Apellido:**
<input name="Apellido" type="text" size="24">
</strong></p>
<p align="left"><strong>
Email:
******
<input name="email" type="text" size="24">
<br>
<br />
Comentarios:</strong><br />
<textarea name="Comentarios" cols="42" rows="9"></textarea>
<br>
</p>
<p align="left">
<label>**************************
<input type="submit" name="button" id="button" value="Enviar" />
</label>
</p>
</div>
</form>
</div>
</body>
</html>


CODIGO DE INSERTAR EN BASE DE DATOS.php
<?php

// Primero comprobamos que ningún campo esté vacío y que todos los campos existan.
if(isset($_POST['Nombre']) && !empty($_POST['Nombre']) &&
isset($_POST['Apellido']) && !empty($_POST['Apellido'])&&
isset($_POST['email']) && !empty($_POST['email'])&&
isset($_POST['Comentarios']) && !empty($_POST['Comentarios'])) {

// Si entramos es que todo se ha realizado correctamente

$link = mysql_connect("localhost","camacho_camacho","passw ord");
mysql_select_db("camacho_clientes",$link);

// Con esta sentencia SQL insertaremos los datos en la base de datos
mysql_query("INSERT INTO Clientes (Nombre,Apellido,email,Comentarios)
VALUES ('{$_POST['Nombre']}','{$_POST['Apellido']},'{$_POST['email']}'{$_POST['Comentarios']}')",$link);

// Ahora comprobaremos que todo ha ido correctamente
$my_error = mysql_error($link);

if(!empty($my_error)) {

echo "Ha habido un error al insertar los valores. $my_error";

} else {

echo "Los datos han sido introducidos satisfactoriamente";

}

} else {

echo "Error, no ha introducido todos los datos";

}

?>


POR FAVOR AYUDENME ES URGENTE NECESITO ENTREGAR ESTO MAÑANA