⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

ajax_list error by Unknown column



carlinchisart

carlinchisart
  • profile picture
  • Member

Posted 20 September 2012 - 03:56 AM

HI all!!!

well i have one problem, all my GC view work, but in one, i have one error, the problem is a database error becouse a unknow colum, but the big problem is that the error only show in the ajax_list method, only when i refresh the list or after the load the grid (in the second call of this method), so i see the error only used firebug.(but i refresh the list with the button and don't work).

the error is becouse in the sql instruction use de orde by[1] 'column' and this 'column' i don't have in database, but, i see my controller code and i don't have a $crud->order_by() method implement.

i don't know what hapen, can help me??

midnigther

midnigther
  • profile picture
  • Member

Posted 20 September 2012 - 09:43 AM

You could enable the message log in CodeIgniter for more details.

To solve the order by problem check this out:
/topic/870-group-by/page__hl__%2Bwhere+%2Bgroup

carlinchisart

carlinchisart
  • profile picture
  • Member

Posted 20 September 2012 - 12:55 PM

@midnigher thank for your answer

the error of db is:
<h1>Ocurrió un error con la base de datos</h1>
<p>Error Number: 1054</p><p>Unknown column 'banco_de_cuentas' in 'order clause'</p><p>SELECT `anticipos`.*, jb80bb774.username AS sb80bb774, CONCAT('', COALESCE(j61cb94a8.nombre, ''), '&nbsp;', COALESCE(j61cb94a8.apellidos, ''), '') as s61cb94a8, j42558d95.nombre_municipio AS s42558d95, j339331cc.nombre_cuenta AS s339331cc
FROM (`anticipos`)
LEFT JOIN `users` as jb80bb774 ON `jb80bb774`.`id` = `anticipos`.`id`
LEFT JOIN `beneficiarios_anticipos` as j61cb94a8 ON `j61cb94a8`.`idbeneficiario` = `anticipos`.`idbeneficiario`
LEFT JOIN `municipios` as j42558d95 ON `j42558d95`.`idmunicipio` = `anticipos`.`idmunicipio`
LEFT JOIN `banco_de_cuentas` as j339331cc ON `j339331cc`.`idcuenta` = `anticipos`.`idcuenta`
WHERE `quien_autorizan_o_rechazan` LIKE '%7%' AND estado='firmas' AND confirmacion_quien_autorizan NOT LIKE '%7%'
ORDER BY `banco_de_cuentas` asc
LIMIT 25</p><p>Filename: D:\inetpub\vhosts\hombresolo.com\httpdocs\hsanticipos\nucleo_codeigniter_ci\database\DB_driver.php</p><p>Line Number: 330</p> </div>


y use in this case a own instruction of where, but i have other user that not have this where instruction, but load the same function and i have the same error

midnigther

midnigther
  • profile picture
  • Member

Posted 20 September 2012 - 14:53 PM

Can you post the grid code here?
Check the field banco_de_cuentas, he exists in database or the name is correct?

carlinchisart

carlinchisart
  • profile picture
  • Member

Posted 20 September 2012 - 15:53 PM

exactly i don't have the field banco_de_cuentas, i have a table with this name this is the controller function:


function recepcionAnticipos(){
$crud = new grocery_CRUD();
$crud->set_table('anticipos');
$crud->set_relation('id', 'users', 'username');
$crud->set_relation('idbeneficiario', 'beneficiarios_anticipos', '{nombre} {apellidos}');
$crud->display_as('id','Solicitado por');
$crud->display_as('idbeneficiario','Beneficiario');
$crud->display_as('idproyecto','Proyecto');
$crud->set_relation('idmunicipio', 'municipios', 'nombre_municipio');
$crud->display_as('idmunicipio','municipio');
$crud->set_relation('idcuenta', 'banco_de_cuentas','nombre_cuenta');
$crud->display_as('idcuenta','Cargado a cuenta');
$crud->display_as('idanticipo','numero de anticipo');
$crud->unset_operations();
if($this->dx_auth->is_role('tesoreria')){
$crud->where('estado','tesoreria');
$crud->order_by('idanticipo');
$crud->columns('idanticipo','id','idbeneficiario','valor_autorizado','numero_tesoreria','numero_formato_impresion','idcuenta');
$crud->add_action('Confirmar transferencia', base_url() . 'images/autorizar.png', '', 'ui-icon-image fancybox.ajax', array($this, '_redirecConfirmarTransaccion'));
$crud->add_action('Numero Control Tesoreria', base_url() . 'images/numero.png', '', 'ui-icon-image fancybox.ajax', array($this, '_redirecGenerarNumero'));
}
else if($this->dx_auth->is_role('gerente')){
$crud->callback_column('detalle_solicitud',array($this,'_callback_detalle_solicitud'));
$crud->columns('idanticipo','id','idbeneficiario','detalle_solicitud','valor_autorizado');
$crud->where("quien_autorizan_o_rechazan LIKE '%".$this->dx_auth->get_user_id()."%' AND estado='firmas' AND confirmacion_quien_autorizan NOT LIKE '%".$this->dx_auth->get_user_id()."%'");
$crud->add_action('Rechazar Anticipo', base_url() . 'images/close.png', '', 'ui-icon-image fancybox.ajax', array($this, '_redirecRechazarAnticipo'));
$crud->add_action('Autorizar anticipo', base_url() . 'images/autorizar.png', '', 'autorizarAnticipoGerencia', array($this, '_redirecConfirmarAnticipo'));
}
else if($this->dx_auth->is_role('Administrador')){
$crud->callback_column('quien_autorizan_o_rechazan',array($this,'_callback_autorizan'));
$crud->display_as('quien_autorizan_o_rechazan','Quienes autorizan');
$crud->callback_column('confirmacion_quien_autorizan',array($this,'_callback_confirmado'));
$crud->display_as('confirmacion_quien_autorizan','Confirmado autorizacion por');
}
$crud->display_as('numero_formato_impresion','Numero formato impreso');
$output=$crud->render();
$output->ruta_vista='example';
$this->load->view('includes/templeate',$output);

}


i use dxauth library to adminitrate the user, but in all user of this function have the error.

and this is the sql code:


CREATE TABLE IF NOT EXISTS `admin_hs_anticipos`.`anticipos` (
`idanticipo` INT NOT NULL AUTO_INCREMENT ,
`fecha_solicitud` DATETIME NULL ,
`tipo_anticipo` ENUM('operativo','administrativo') NULL ,
`idbeneficiario` INT NOT NULL ,
`idproyecto` VARCHAR(100) NULL ,
`idmunicipio` INT NOT NULL ,
`observacion_anticipo` TEXT NULL ,
`valor_solicitado` VARCHAR(45) NULL ,
`codigo_servicio` VARCHAR(45) NULL ,
`estado` ENUM('solicitado','no aceptado','solicitado operativa','firmas','tesoreria','transferido','legalizado') NULL ,
`numero_formato_impresion` INT NULL ,
`valor_autorizado` VARCHAR(45) NULL ,
`numero_tesoreria` INT NULL ,
`idcuenta` INT NULL ,
`id` INT(11) NULL COMMENT 'relacion con el id del usuario de la tabla user para iniciar sesion\n' ,
`observaciones_rechazo_anticipo` TEXT NULL ,
`quien_autorizan_o_rechazan` VARCHAR(100) NULL COMMENT 'referencia los id de la tabla users separados por comas quienes autorizan este anticipo o bien quienes se envia correo cuando se rechaza el anticipo' ,
`confirmacion_quien_autorizan` VARCHAR(100) NULL ,
PRIMARY KEY (`idanticipo`) ,
INDEX `fk_detalle_anticipo_tecnicos1` (`idbeneficiario` ASC) ,
INDEX `fk_anticipos_municipios1` (`idmunicipio` ASC) ,
CONSTRAINT `fk_detalle_anticipo_tecnicos1`
FOREIGN KEY (`idbeneficiario` )
REFERENCES `admin_hs_anticipos`.`beneficiarios_anticipos` (`idbeneficiario` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_anticipos_municipios1`
FOREIGN KEY (`idmunicipio` )
REFERENCES `admin_hs_anticipos`.`municipios` (`idmunicipio` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;



i don't know why in de ordeby have this parameter.

fredconv

fredconv
  • profile picture
  • Member

Posted 05 October 2012 - 15:44 PM

Hi

I ve the same problem. currently the order takes the value from the order in another pages and seems to be passed to the controller ..
Do you have in other table from your db taht is called "banco_de_cuentas" ?

Any new about how to resolve this one ?

Thanks