este es el formulario por el que se meten los articulos a la base de datos:
Código PHP:
</script>
<!-- /TinyMCE -->
</head>
<body>
<form method="post" action="enviararticulo.php">
<div>
<br>Ubicación:</br>
<br>
<label>
<select name="select">
<option>inicio</option>
<option>documentos</option>
<option>fotos</option>
<option>videos</option>
<option>contacto</option>
<option>comentarios</option>
</select>
</label>
<h3>
<!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded -->
</h3>
<div>
<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%"></textarea>
</div>
<br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</div>
</form>
<script type="text/javascript">
if (document.location.protocol == 'file:') {
alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver.");
}
</script>
Código PHP:
<?php
$bdconex = @mysql_connect("localhost", "root", "****");
if (!$bdconex) {
echo ( "<h1>La base de datos no está disponible</h1> " .
"<p>Por si acaso, comprueba que tienes bien los datos de la dirección, el nombre de usuario y la contraseña.</p>" );
exit();
}else {
echo ("");
}
if (! @mysql_select_db("basedatos", $bdconex)){
echo "<h2 align='center'>ERROR3: Imposible localizar la base de datos en este momento</h2>";
exit();
}else {
echo "Base de datos seleccionada";
}
$sql =" INSERT INTO articulos ( id, ubicacion , articulo , fecha ) VALUES ( NULL, '".$_POST['ubicacion']."' , '".$_POST['articulo']."' , ',CURDATE() )";
if(mysql_query($sql, $bdconex)){
echo ("<p> Gracias por tu comentario, será redirigido automaticamente a la pagina de comentarios.</p>");
}else{
echo ("Error al insertar los datos: " . mysql_error() . "</p>");
}
if(mysql_query($sql, $bdconex)){
echo ("<p> </p>");
}else{
echo ("Error al insertar los datos: " . mysql_error() . "</p>");
}
?>
Base de datos seleccionada
Notice: Undefined index: ubicacion in C:\wamp\www\...\...\admin\enviararticulo.php on line 20
Notice: Undefined index: articulo in C:\wamp\www\...\...\admin\enviararticulo.php on line 20
Error al insertar los datos: 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 '',CURDATE() )' at line 1
Error al insertar los datos: 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 '',CURDATE() )' at line 1
Que es lo que tengo mal? es que nose que puede ser.
Gracias.