I am trying to get the SUM of 3 individual columns. When I try to output I get nothing. What do I do wrong? Model Controller View Answer $this->db->select() accepts an optional second parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names. This is useful if you need a compound select
Tag: codeigniter
Convert Sql query to sql CodeIgniter
convert sql query to sql codeigniter i done try to use this method How to convert sql query to codeigniter active records but not working for me… so i try to post in here this my sql query $…
How to update multiple records in Codeigniter
In above code snippet first function is declared in controller and second function is declared in model. I want to update owner for multiple rows having ids in $astrep. Can anyone please help me? Answer You can use whereIn() or orWhereIn() methods from query builder class. Refer https://codeigniter4.github.io/userguide/database/query_builder.html#looking-for-specific-data
how to show the selected value from database in select box in codeigniter
Here I have a select box where I want to show the value which is stored in the database that is in the JSON format. If the value is present, it shows the selected value, otherwise it shows the default option Delete leads option. It’s not working properly. Can anyone please help me? Answer I think you could change the
How to use Like statement?
I meet an error like this: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘TANAH’%’ AND a.id_bencana=b….
Codeigniter MySQL filtering data as per user ID in the session
I have following function in my model to select records as per the user ID in the session. public function getOfficer() { $usr = $this->session->userdata(‘id_user’); $userArray = $…
Codeigniter MySQL select max using varchar type value
I want to select max auto_no from the following varchar type column in my codeigniter model +————+ | auto_no | +————+ | 2020-00821 | | 2020-00822 | | 2020-00823 | | 2020-00824 | | …
How to change query result into another value in MYSQL?
For example, I have a column named ‘form_type’ consisted of int (1-4) id_event|form_type ——–|———- 001 |1 001 |3 001 |4 002 |2 002 |1 When i query SELECT form_type …
#1241 – Operand should contain 1 column(s) In wamp on phpmyadmin
Nested query in Sql. SELECT *, (SELECT `supplier_sign_up_id`, ( SELECT email_address FROM supplier_sign_up WHERE …
Remove matching values by comparing two database tables Codeigniter/Mysql
In my codeigniter model I have this function : public function getUserNo() { $query = $this->db->query(“select userno from Users where active=1”); return $query->result_array(); } …