Ver Mensaje Individual
  #9 (permalink)  
Antiguo 28/01/2010, 05:11
xiskoct
 
Fecha de Ingreso: enero-2010
Mensajes: 46
Antigüedad: 14 años, 3 meses
Puntos: 0
Respuesta: Duda en una consulta

Vale flipisnetlo he ejecutado en phpmyadmin lo siguiente:

"SELECT * FROM bd.contratos WHERE cif="123456 OR idcontrato like '%".12."%' or cif like '%".12."%' or idservicio like '%".12."%' or fAlta like '%".12."%' or fBaja like '%".12."%' or Horas like '%".12."%'";

y me devuelve un error de la sql:

#1064 - 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 '"SELECT * FROM bd.contratos WHERE cif="123456 OR idcontrato like '%"12"%' or cif' at line 1

y la estructura de la tabla es la siguiente:

CREATE TABLE IF NOT EXISTS `contratos` (
`idcontrato` smallint(6) NOT NULL auto_increment,
`cif` tinytext NOT NULL,
`idservicio` smallint(6) NOT NULL,
`fAlta` date NOT NULL,
`fBaja` date NOT NULL,
`Horas` time NOT NULL,
PRIMARY KEY (`idcontrato`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=234 ;