I have this line of sql: It works perfectlly when I only need to insert, but it is failing when trying to update,it has an user_id that is primary key, so I hope thats what gets on the key, the other array variables $datosArr are strings, any ideas? Basically im trying to update when user_id exists , I want t…
Tag: codeigniter-4
Mutli Application Calling Model From Shared Site In Single Installation Codeigniter 4
How to call models from other multi application site in single installation codeigniter 4 ? The folder structure look like this : This is my example code : In Site1 Constants.php I have define a root directory to targeted the site2. This return : E:Projectwebsitesite2 Autoload.php I have setup PSR4. Then I Ru…
In CodeIgniter 4 Flashdata displaying code redirecting to again again in the same page
In the CodeIgniter 4, I am using Flashdata for displaying error or success messages in view page and I am using the below code: It is not and as well as it redirect frequent in same page using this code! Answer use Flashdata instead of session. Once you reload the page, flashdata will disappear You can warp i…
Codeigniter 4 : “Attempt to read property ‘name’ on array” error when executing ->findAll() on the BaseBuilder
this is my first time exploring Codeigniter 4 and I follow some tutorials to understand the basic crud process. Below are my controller where the model query is used. Then below are the index page where I want to display the list and the part where I have a problem. ‘name’ and ‘description&#…
How to use foreign keys migration with database migrations. (errno: 150 “Foreign key constraint is incorrectly formed”)?
CodeIgniter 4 has a handy solution for migrations and seeders. Without the usage of foreign keys, everything is working perfectly. But when I use foreign keys I get “Unable to add foreign key”. This is because of the order of happenings: Quick example: So when I now run php spark migrate or php sp…
CodeIgniter 4: Pass $data to the View file
Can someone help me with this? I can’t figure out on how can I show the results on the View file. I tried using $this->load->view(‘list-logs’,$data); but it shows the error Call to a member function view() on null. CONTROLLER VIEW Answer if you use CodeIgniter 4 then you must call the …
Codeigniter 4 localization issue with UTF-8 characters
The context I am trying to perform a lemmatization of some texts and I figured out that I can use CI4 localization for this. Basically I created some files in AppLanguagesro-RO and I am “translating” the words to their linguistic root. The language files are encoded in UTF-8 (I checked it on the s…
Setting Parameters in CI4s redirecting function
is there any possible way to send parameters within the redirection function from Codeigniter 4? Important, it is a named route: And i want to do a redirect like this: this works fine: this would be nice, if it works: or Why? I have HMVC and I would like to name every module with the same routes but different…
Codeigniter4 how to call parent controller’s constructor from derived class constructor
In Codeignter 4 we can’t use constructor in BaseController. But the method initController() will do it. But how can call this method from derived controller’s constructor? My question is that BaseController::is_allowed() method will do all basic features that are commonly useful for all derived co…
How to use CI4 parser service to render view from module
I’m trying to load views from module folder, since CI always look for views in App/View folder, how this can be overwritten to give complete path from ROOTPATH instead of APPPATH/Views Error CodeIgniterViewExceptionsViewException Invalid file: {path/to/project}/app/Config/../Views/modules/PluginName/Vie…