Using a sql alias within a model's find() function |
PHP Code: $locale = service('request')->getLocale(); However, the more appropriate way to do this would be to create a locale column and then modify your query to be: PHP Code: "select test FROM tblzz WHERE locale={$locale};" CodeIgniter isn't opinionated on how you handle localization when using a database, so the way to do is left up to the developer. If your table is primarily static and the information won't change, you're better off using the flat file approach that's already supported within CodeIgniter. You can store the data as a serialized array (if for some reason you need it raw) or with html already embedded. |
Messages In This Thread |
Using a sql alias within a model's find() function - by Pardner - 04-06-2025, 02:30 PM
RE: Using a sql alias within a model's find() function - by InsiteFX - 04-07-2025, 01:02 AM
RE: Using a sql alias within a model's find() function - by grimpirate - 04-07-2025, 09:43 AM
RE: Using a sql alias within a model's find() function - by michalsn - 04-07-2025, 10:13 PM
|