Questions tagged [codeigniter-query-builder]
95 questions
3
votes
5 answers
How to insert dynamic data in Codeigniter?
I just want to insert dynamic generated input field data into database . My db table having three fields , id(Auto Increment), product_name and rate . I'm trying to insert bulk data into database using dynamically generated input fields where I can…

Sudhi Sr
- 139
- 1
- 2
- 10
2
votes
1 answer
Codeigniter 4 query builder join display only 1 time from first table
I have done up a query builder using join. I would like to show table 2, 3, 4, 5, 6 and so on based on the user id on table 1. I tried to query the result, it is showing like this :
My Tables
Table users
user_id | username | email
1 …

Dr3am3rz
- 523
- 1
- 13
- 41
2
votes
2 answers
codeigniter using case statement for joins
Here is my query for codeigniter model
$this->db->select('wo.*,
en.equipment_name as conventional_name,
cat.name as category_name,
toe.name as type_of_equipment_text,
wos.wo_status,
l.name…

Muhammad Asif Raza
- 647
- 2
- 5
- 24
2
votes
1 answer
How to delete an array present inside where_in condition in codeigniter?
I have where_in condition $this->db->where_in('student_id',$arr); Now I want to delete the contents present in $arr from a table using this code $this->db->delete('top_students'); But I got a database error
"You have an error in your SQL syntax;…

Dishi
- 41
- 6
2
votes
2 answers
How to Pass Mutliple data to codeigniter controller
I am working on a template, i need to pass database results into jquery datatables in view page. now the problem is there is also a template named located at application/view/admin/layout.php that we use globally it includes head, footers, sidebars,…

Ojibix Creatives
- 97
- 1
- 12
2
votes
1 answer
How to use OR_Where with AND condition in CodeIgniter?
I am using CodeIgniter. I need to understand how where and or_where condition working in codeigniter query builder.
I need an output like where a="" AND b="" AND c="" OR d="" AND e=""
so I tried an associative array.
$where=…

user9437856
- 2,360
- 2
- 33
- 92
2
votes
2 answers
Delete record with out page refresh in codeigniter is not working
Hi all i am trying to delete my record from datatable with out page refresh in codeigniter i have used ajax i don't know where i have done mistake its not deleting the record
Below is the my view:

suresh
- 439
- 3
- 18
2
votes
1 answer
Update array query in Codeigniter
I am making pharmacy system using Codeigniter. I want to update stock of several items in table after purchase, below is the code what i have tried so far.
Below is the my Controller
function add_invoice(){
$customer =…

Ria W
- 67
- 1
- 8
2
votes
4 answers
How to retrieve the column values in codeigniter?
I am trying to retrieve the config_value on the basis of config_name from the table as shown in image in codeigniter project. Even i am not able to understand where to start.I find something like this on internet (for…

Ajay Singh
- 69
- 1
- 10
2
votes
1 answer
Codeigniter :Use of undefined constant
This is my Model:
class Medecin_model extends CI_Model
{
public $fillable = array('nom','prenom','genre','adresse','date_naissance','specialiter','servise','grade','etablissement','type_personne');
public $id_medecin;
public $nom;
…

Miled
- 109
- 2
- 13
2
votes
4 answers
How to fetch data from database and display it in a drop down list using Codeigniter
I collect data from the database table and display it in the drop-down list, here's what I've done so far
THIS IS MY CONTROLLER:
public function assign_hostel() {
$inner_page_title = 'Assign Hostel';
$this->admin_header('Assign…

Sylvester
- 23
- 3
2
votes
1 answer
How can I do a between date query using codeigniter?
I´m trying to do a query where I select the start date and end date and page should display all the records stored between those dates, I have two inputs type date on view, well look at the examples.
This is my Controller:
public function…

Adrian Jimenez
- 979
- 9
- 23
1
vote
1 answer
CodeIgniter 4: How to write conditional statements using the query builder chain. I.e., if...then
The following returns a mysqli_sql_exception error in the live server. I have traced the error from the following block of code:
public function getByOPCR($opcr_id, $kpi_ids)
{
return $this->select('opcr_success_indicators.*, kpis.name,…

be_mpty
- 33
- 4
1
vote
1 answer
Codeigniter 4 is_unique rule validation throws not unique error when I update record
I have a simple form that stores some data in the database and for the Title field I have an is_unique validation rule along with others. Following are my validation rules from the TaskModel:
protected $validationRules = [
'Title' =>…

Sardar_Umer
- 25
- 1
- 5
1
vote
1 answer
codeigniter 4 mysql query builder get subdata from itself
[UPDATED]
the error is now gone but the data result from the codeigniter 4 query builder all has the same id value, unlike the one in phpmyadmin. and if I use the $builder method it now gives the expected result, but I'm still hoping to be able to…

dapidmini
- 1,490
- 2
- 23
- 46