I've no idea what is causing this. It claims that the save worked, but there is no new data. I turned on the code igniter profiler, and I can see lots of selects but nothing adding to the database.
Weird thing is, if I edit an existing record it works fine. Only problem is when adding a new record.
public function index() {
// redirect if user isn't logged in
if (!$this->ion_auth->logged_in()) {
redirect('/');
}
$crud = new grocery_CRUD();
$crud->where('user_id',$this->user->id);
$crud->set_table('New_userStocks')
->fields('company_id','boughtDate','boughtPrice','shares','boughtCommission',
'soldDate','soldPrice','soldCommission','scInspired', 'userNotes','expert_id')
->set_subject('Investment')
->columns('company_id','boughtDate','userNotes','boughtPrice','shares','boughtCommission','soldDate','soldPrice','soldCommission','profit')
->display_as('company_id','Company')
->display_as('boughtDate','Bought')
->display_as('boughtPrice','Purchase Price')
->display_as('shares','Shares')
->display_as('boughtCommission','Bought Commission Cost')
->display_as('soldCommission','Selling Commission Cost')
->display_as('soldDate','Sold')
->display_as('soldPrice','Sale<br>or<br>Current<br>Price')
->callback_column('soldPrice',array($this,'_callback_SoldPrice'))
->field_type('userNotes','text')
->callback_column('profit',array($this,'_callback_Profit'))
->display_as('scInspired','StockChase Inspired')
->display_as('userNotes','Notes')
->callback_column($this->unique_field_name('company_id'),array($this,'_callback_company_url'))
->callback_column('boughtDate',array($this,'_callback_boughtDate'))
->callback_column('userNotes',array($this,'_callback_Price'))
->set_relation('company_id','New_company','{symbol} {name}')
->set_relation('expert_id','New_expert','{name}<!--{id}-->');
if ($crud->getState() == 'list') {
$crud->display_as('boughtCommission','+Cost')
->display_as('soldCommission','+Cost');
}
$crud->field_type('scInspired','true_false',array('No','Yes'));
$crud->field_type('boughtDate','date');
$crud->required_fields('company_id');
$detailoutput = '';
$table_view = $crud->render();
$this->template->title('My Portfolio');
$this->template->build('portfoliog',$table_view);
//$this->load->view('example.php',$crud->render());//<input id='field-boughtDate' name='boughtDate' type='text' value='' maxlength='10' class='datepicker-input' />
}
Can you point me in a direction to look please?
