Jump to content


Flashy

Member Since 27 Jan 2016
Offline Last Active Feb 04 2016 06:34 AM
-----

Topics I've Started

How to use set the select dropdown value field other that the primary value

27 January 2016 - 02:25 AM

When I use the "set_relation" function, how can I use a different database column value for the selects option value that is output?

 

Is the default valued used when rendered the tables Primary key value? - how can I use a value from another column?

 

 

My Code:

 

$this->crud->set_relation('show','statuses','title', array('group' => 'yn'));

 

This is the database structure of the statuses table:

 

CREATE TABLE `statuses` (
  `id` int(4) NOT NULL AUTO_INCREMENT,
  `title` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  `value` int(4) NOT NULL DEFAULT '0',
  `group` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

 

 

I want to use the "value" column results not the id column