⚠ 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

Date filed type not shown in the table



Alkhamis
  • profile picture
  • Member

Posted 13 July 2015 - 10:24 AM

Hello,
I am new to Grocery CRUD.
I am impressed by how much time saver this library is and i want to thank all great developers who worked on this project.
 
i have a small problem with showing the date field in the table. when i press the edit button , it's shown in the edit and view pages.
but it doesn't appear in the table.
 
Even if i create the record myself from the add record button, it's saved successfully but not shown in the table.
i have checked many things like the default format of the date in the library. 

$config['grocery_crud_date_format'] = 'sql-date';

 

I tried different web browsers

 

this is my table and how i update the date and save it to the DB:

$datestring = "%Y-%m-%d";
$time = time();

 $data = array(
                    'Attendence_date_daily' => mdate($datestring, $time),
                    'Check_in_time' => null,
                    'Check_out_time' => null,
                    'Attendence_status' => null,
                    'Employee_comment' =>null,
                    'Deducted_today' => 0,
                    'user_id' => $row->id
                    );
 

this is how i created the table

 

  
public  function edit_daily_record()
                    {
                              $crud = new grocery_CRUD();
                                        
                                       $crud->columns('daily_record_id','Attendance_date_daily','Check_in_time','Check_out_time','Attendence_status','Employee_comment','Deducted_Today','user_id');
                                       $crud->set_table('daily_attendence_record');
                                       $crud->display_as('Attendance_date_daily','Date')
                                                 ->display_as('user_id','Employee');
                                       $crud->set_subject('daily record');
                                       $crud->set_relation('user_id','users','username');
                                       $output = $crud->render();
                            $this->_example_output($output);
                    }

where 'Attendance_date_daily' is of type date in mysql DB . All fields are shown correctly except this date

 

'daily_record_id' is auto increment PK

'user_id' is a FK

can you please help me with this problem? 

image 1

 

143678291041.png
 
 
image 2
1436782910582.png

 


Paul Savostin
  • profile picture
  • Member

Posted 13 July 2015 - 10:55 AM

Hi! Show table database shema, show screen of this table from phpmyadmin. And for type date it will be date('Y-m-d', time_in_seconds)


Alkhamis
  • profile picture
  • Member

Posted 13 July 2015 - 11:46 AM

thanks for your quick reply.

Here is the table from phpmydamin

1436787873581.png

 

I don't think that the problem in the schema since it's shown in the view and the edit pages of every record

see pic 2 of first post


Paul Savostin
  • profile picture
  • Member

Posted 13 July 2015 - 12:16 PM

Not only this screen. I am interesting about existing values in DB. But all seems clear to me - check field name in table and in conrtoller, they diff in one letter:) Be careful!


Alkhamis
  • profile picture
  • Member

Posted 13 July 2015 - 12:48 PM

Not only this screen. I am interesting about existing values in DB. But all seems clear to me - check field name in table and in conrtoller, they diff in one letter:) Be careful!

that is so funny to miss such a thing
i solved the issue thanks to you.
this shows how a letter can change the whole thing.

 

I just wonder why i didn't get not found column error or something like that?
can you create columns by just typing $crud->columns

thanks again for your help

cheers


Paul Savostin
  • profile picture
  • Member

Posted 13 July 2015 - 13:04 PM

that is so funny to miss such a thing
i solved the issue thanks to you.
this shows how a letter can change the whole thing.

 

I just wonder why i didn't get not found column error or something like that?
can you create columns by just typing $crud->columns

thanks again for your help

cheers

Because you dont save or update column, this operations only with fields. And if column have name that not equal any field name - null is return (or empty string, not sure)

"can you create columns by just typing $crud->columns" - yes you can, but to output something useful, you need to create callback and there do the all magic you want

you're welcome