Ver Mensaje Individual
  #5 (permalink)  
Antiguo 30/10/2011, 10:07
Avatar de ahaugas
ahaugas
 
Fecha de Ingreso: agosto-2011
Ubicación: Madrid
Mensajes: 249
Antigüedad: 12 años, 8 meses
Puntos: 21
Pregunta Respuesta: problema al hacer un filtrado

en la forma exacta que me dices me da esto
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 'Genero= 'Ciencia-Ficcion'' at line 1

pero asi no hace nada de nada

Código PHP:
Ver original
  1. if(!empty($_POST['pelicula'])){
  2.         $sql = "SELECT * FROM Peliculas WHERE Nombre= '{$_POST['genero']}'";
  3.     }
  4. if(!empty($_POST['genero'])) {
  5.         $sql = " SELECT * FROM Peliculas WHERE Genero= '{$_POST['genero']}'";
  6.     }
  7.         $sql = "SELECT * FROM Peliculas WHERE 1=1";
  8.    
  9. $query = mysql_query($sql) or die(mysql_error());