CodeIgniter Forums
Change variable value in php file - 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: Change variable value in php file (/showthread.php?tid=68892)



Change variable value in php file - omid_student - 09-11-2017

Hello
I have below data in application/config/config.php
$config['sms_number'] = '0123124123123';

Now i need to change it without manual
So i need get data via user and set it to $config['sms_number']
Maybe?


RE: Change variable value in php file - Wouter60 - 09-11-2017

Don't. Store the value in your database and create a form to change the value and update the record.


RE: Change variable value in php file - omid_student - 09-11-2017

(09-11-2017, 07:52 AM)Wouter60 Wrote: Don't. Store the value in your database and create a form to change the value and update the record.

Why?


RE: Change variable value in php file - rtenny - 09-11-2017

I dont quite understand your problem? If the sms number changes why would you have it in the $config array in the first place?
The config is normally used for things that dont change.

When does the number change? When a user logs in? Then I agree with Wouter60 the sms number should be in the database with the other user relevant data.


RE: Change variable value in php file - natanfelles - 09-11-2017

https://codeigniter.com/user_guide/libraries/config.html?highlight=config#setting-a-config-item


RE: Change variable value in php file - omid_student - 09-11-2017

(09-11-2017, 08:49 AM)rtenny Wrote: I dont quite understand your problem? If the sms number changes why would you have it in the $config array in the first place?
The config is normally used for things that dont change.

When does the number change? When a user logs in? Then I agree with Wouter60 the sms number should be in the database with the other user relevant data.

I understood your purpose.
I try save data in database
Thanks