0

嘿伙计们,我的 MySQL 有问题,我正在尝试在表中插入数据,但它返回此错误消息

致命错误:SQL: SELECT e.idtarea AS 'idTarea', e.detalle AS 'detalle', e.precio AS 'precio', e.idor AS 'idOrdenReparacion', e.fecha AS 'fecha', concat('Editar ', 'Eliminar' ) AS Opciones FROM Tarea e WHERE e.idtarea like '%%' ORDER BY e.idtarea;, 错误:/opt/lampp/htdocs/scep 中的 'field list' 中的未知列 'e.idor' /tareas.php 在第 76 行

这是我的代码:

$SQL="

  SELECT 
    e.idtarea AS 'idTarea', 
    e.detalle AS 'detalle', 
    e.precio AS 'precio', 
    e.idor AS 'idOrdenReparacion', 
    e.fecha AS 'fecha', 
    concat('<a href=\'editarTarea.php?id=',e.idtarea,'\'>Editar</a>&nbsp;','<a href=\'eliminarTarea.php?id=',e.idtarea,'\' onclick=javascript:confirm(\'Eliminar?>\')>Eliminar </a>') AS Opciones 
  FROM Tarea e ".$FILTRAR_POR." 
  ORDER BY e.idtarea;";

  $RESULT = mysql_query($SQL) or trigger_error("SQL: $SQL, Error: " . mysql_error(), E_USER_ERROR); 

来自数据库的表 Tarea:

  CREATE TABLE IF NOT EXISTS `Tarea` (
   `idTarea` int(11) NOT NULL AUTO_INCREMENT,
   `detalle` varchar(45) COLLATE latin1_danish_ci DEFAULT NULL,
   `precio` varchar(45) COLLATE latin1_danish_ci DEFAULT NULL,
   `idOrdenReparacion` int(11) NOT NULL DEFAULT '0',
   `fecha` date DEFAULT NULL,
   PRIMARY KEY (`idTarea`,`idOrdenReparacion`),
   KEY `fk_Tarea_OrdenReparacion1_idx` (`idOrdenReparacion`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_danish_ci AUTO_INCREMENT=2 ;

.....

  ALTER TABLE `Tarea`
  ADD CONSTRAINT `fk_Tarea_OrdenReparacion1` FOREIGN KEY (`idOrdenReparacion`) 
  REFERENCES `OrdenReparacion` (`idOrdenReparacion`) ON DELETE NO ACTION ON UPDATE NO ACTION; 

有任何想法吗?

4

1 回答 1

2

您没有表格中的idorTarea,但您正在尝试选择它。

于 2012-11-06T15:57:42.697 回答