Tema: Error MySQL
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/09/2015, 02:20
diegoguerrero
 
Fecha de Ingreso: diciembre-2014
Ubicación: Madrid
Mensajes: 274
Antigüedad: 10 años, 3 meses
Puntos: 5
Error MySQL

El código posterior me da un error de booleano (Warning: mysql_query() expects parameter 2 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/cooperativo/paginas/tareas/nueva-guardar.php on line 18) ¿Cómo se podría solventar?
Código PHP:
<?php
/* CREAR LA CONEXIÓN A MYSQL */
$sql mysql_connect('localhost','root','');
$sql_preparado mysql_select_db('cooperativo',$sql);
/* RECIBIR VARIABLES DEL $_POST */
$nuevo_style $_POST['materia'];
$nuevo_descripcion $_POST['descripcion'];
$nuevo_fechafin $_POST['fechafin'];
/* CREAR A PARTIR DE $STYLE EL $MATERIA */
if ($nuevo_style == 'len'){
    
$nuevo_materia 'Lengua Castellana';
}elseif (
$nuevo_style == 'ccss'){
    
$nuevo_materia 'Ciencias Sociales, historia';
}else{
    exit;
}
/* EJECUTAR EL COMANDO */
$tarea mysql_query ('INSERT INTO tareas VALUES style='.$nuevo_style.', descripcion='.$nuevo_descripcion.', materia='.$nuevo_materia.', fechaentrega='.$nuevo_fechafin,$sql_preparado);
?>