Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter.com - Report problems!
#61
Sad 

(03-09-2022, 12:27 AM)InsiteFX Wrote: CodeIgniter 4 uses Events instead of Hooks. So you want to read up on the CodeIgniter 4 Event system.

Hello, Thanks for the help, I understand now how it works, but I am trying to get these settings available globally, 

Code:
ErrorException
Creating default object from empty value
APPPATH/Config/Events.php at line 58

52 Events::on('pre_system', static function () {
53    $configs = Database::connect()
54                    ->query('SELECT * FROM setting ')
55                    ->getResult();
56    foreach($configs as $config)
57    {
58        config($config->setting_type)->{$config->name} = $config->value;
59    }
60 });

I have theese three fields in my table seting_type has simmilar value, name and value has respective value. could you plese tell me what I am doing wrong here?
Reply
#62

Please read this.

CodeIgniter 4 User Guide -> Generating Query Results -> Result Arrays
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#63

(03-10-2022, 01:03 AM)InsiteFX Wrote: Please read this.

CodeIgniter 4 User Guide -> Generating Query Results -> Result Arrays

Thanks! I've looking for this for a while now
Reply
#64

thanks
Reply
#65

Report problem is a necessity to monitor and can fix for next time 
fleeing the complex
Reply
#66

I am not sure that having issue in CodeIgniter 4 or not but I am getting issue to show two times db prefix in query while I use Like. Following is my query. mysqli_sql_exception #1054

$order_status_ids = [14, 21];
$builder = $this->db1->table('order');
$builder->join('order_product', 'order.order_id = order_product.order_id','LEFT');
$builder->Like('order_product.name', $_GET['query']);
$builder->whereIn('order.order_status_id', $order_status_ids);
$query = $builder->get();
return $query->getResultArray();

Showing query like as below. "ssiegel_" is my db prefix. I am using multi database connection. As you can see that adding two times prefix in like condition [ssiegel_``ssiegel_order_product.name LIKE ]

SELECT * FROM ssiegel_order LEFT JOIN ssiegel_order_product ON ssiegel_order.order_id = ssiegel_order_product.order_id WHERE ssiegel_``ssiegel_order_product.name LIKE '%Apple Fiber Powder%' ESCAPE '!' AND ssiegel_order.order_status_id IN (14,21)

Any one have solution for this issue or any updates in CodeIgniter 4 to update liabrary. 
Thanks in advance!
Reply
#67

I have primarily been learning Symphony and haven't looked at Code Igniter mainly because there seemed to be a mass consensus that something like Laravel/Symphony etc. would be better but I decided to checkout it again and was pleased with the experience. Its simplicity is a real plus point for me.
Reply
#68

Why are there some irrelevant posts under this thread?
Reply
#69

(01-19-2023, 12:36 AM)demyr Wrote: Why are there some irrelevant posts under this thread?

There are irrelevant posts in all threads and mods are OK with that (answering or ignoring them).
Reply




Theme © iAndrew 2016 - Forum software by © MyBB