Welcome Guest, Not a member yet? Register   Sign In
Error when adding a datepicker
#2

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.
Reply


Messages In This Thread
Error when adding a datepicker - by Mekaboo - 02-05-2020, 09:15 AM
RE: Error when adding a datepicker - by zahhar - 02-06-2020, 01:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB