Error when adding a datepicker - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Error when adding a datepicker (/showthread.php?tid=75430) |
Error when adding a datepicker - Mekaboo - 02-05-2020 Hello all!! Im trying to add a datepicker but came into an error....wanted to see if anyone can can help. Here is the code: Error: A PHP Error was encountered Severity: Notice Message: Trying to get property of non-object Filename: register/index.php Line Number: 29 Backtrace: File: /home4/cultured/public_html/application/views/register/index.php Line: 29 Function: _error_handler File: /home4/cultured/public_html/application/libraries/Template.php Line: 33 Function: view File: /home4/cultured/public_html/application/controllers/Register.php Line: 356 Function: loadContent File: /home4/cultured/public_html/index.php Line: 318 Function: require_once 12/31/1969"> Code: <div class="form-group login-form-area has-feedback"> Im trying to make the "relationship" form group to resemble the "login" form group but cant get it right. I purchased the script and the seller has been helpful but I haven't heard from them in regards to fixing this code. Thank ya so very much!! , Mekaboo RE: Error when adding a datepicker - zahhar - 02-06-2020 Dear Mekaboo, It is not possible to help you well to solve your issue based on information you are providing. So I will give you only a general hint where to look for the root cause. You have an issue when passing parameters to PHP built in date() function. This function expects 2 parameters: date ( string $format [, int $timestamp = time() ] ) You are passing: date($this->settings->info->date_format, $this->user->info->birthdate) Error message "Trying to get property of non-object" means that at least one of the parameters does not exist. Either "$this->settings->info", or "$this->user->info" does not exist, or exist as an Array and not an Object type that is expected in order to read attributes "date_format" and "birthdate" using object notation (e.g. "->"). What you can do: 1. Use isset() and gettype() functions to figure out if $this->settings->info and $this->user->info are present before using them in date() function. They must be present and must be Object type. If they are present, but happen to be an Array type, probably you can acces them using this->settings->info['date_format'] and $this->user->info['birthdate']. If they are NOT present, you have to look into your Register.php controller and check that they are set there correctly. 2. Use gettype() to verify that $this->user->info->birthdate is integer (INT) as expected by date() function 3. You may also use dd() function from Codeigniter, and Debug Toolbar to troubleshoot your application during development. Read about those features in the docs. |