Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/06/2004, 13:13
kiewic
 
Fecha de Ingreso: abril-2004
Ubicación: Ciudad de México
Mensajes: 52
Antigüedad: 20 años
Puntos: 1
ayuda con php y mysql

intento hacer mi primera base de datos, solo quiero que las personas dejen su nombre y su email, mi codigo es este


<?php
//si la forma ha sido enviada editamos el registro.
if(isset($_POST['submit'])){

include ("bd/config.php");
include ("bd/funciones.php");
//nos conectamos a mysql
$cnx = conectar ();

$campos = "nombre,apellido,nick,email,url";
$valores = "'".$_POST['nombre']."',";
$valores .= "'".$_POST['apellido']."',";
$valores .= "'".$_POST['email']."',";
$sql = "INSERT INTO emails ($campos) VALUES($valores)";
$res = mysql_query($sql) or die(mysql_error());
echo "Registro ingresado.<br><a href='listado.php'>regresar</a>";
mysql_close($cnx);
exit;
}
?>
<form name="form1" method="post" action="<?echo $_SERVER['PHP_SELF'];?>">
<table width="400" border="1" cellpadding="0" cellspacing="0">
<tr>
<td>nombre</td>
<td><input name="nombre" type="text" id="nombre" value=""></td>
</tr>
<tr>
<td>apellido</td>
<td><input name="apellido" type="text" id="apellido" value=""></td>
</tr>
<tr>
<td>email</td>
<td><input name="email" type="text" id="email" value=""></td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right"><input type="submit" name="submit" value="enviar"></td>
</tr>
</table>
</form>


y me sale este error del que no he podido avanzar:



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 ')' at line 1


si alguien me puede echar una manita, se los mega agradeceria