Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/11/2007, 05:40
francibj
 
Fecha de Ingreso: noviembre-2007
Mensajes: 51
Antigüedad: 16 años, 5 meses
Puntos: 0
Pregunta por que no funciona???

<head>
<?PHP
$conexion = mysql_connect("localhost", "root", "asge");
mysql_select_db("telefonos", $conexion);

$sql = "INSERT INTO 'telefonos_datos' ('NOMBRE', 'EXTEN_MOVIL', 'TLFNO', 'CABEZA DE GRUPO') ";

$sql .= "VALUES ('".$nombre."', '".$extension."', '".$telefono."', '".$cabeza_grupo."')";

$result = mysql_query($sql);

if (mysql_query($sql)){
//si se consiguio insertar el nombre
echo "todo correcto";
}else{
//no se ejecuto la sentencia correctamente
echo "hubo un error";
echo mysql_error();
}
?>
</head>
<style type="text/css">
<!--
.Estilo1 {
font-size: 24px;
font-weight: bold;
}
-->
</style>
</head>
<body>

<form>
<p><span class="Estilo1">Introduzca un nuevo dato</span></p>

<p align="center">Nombre y apellidos
<input type="text" />
</p>
<p align="center">Extension
<input type="text" />
</p>
<p align="center">Telefono
<input type="text" />
</p>
<p align="center">Cabeza de grupo
<input type="text" />
<p align="center">
<label>
<input type="submit" name="Insertar" id="Insertar" value="insertar" />
</label>

<a href="trabajo php/USUARIOS.html">VOLVER</a>
</form>
</html>
</body>



Y ME DA ESTE ERROR:

hubo un errorYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''telefonos'. telefonos_datos (NOMBRE, EXTEN_MOVIL, TLFNO, CABEZA