Questions tagged [codeigniter-query-builder]

95 questions
1
vote
1 answer

How get 2 or more input values when dropdown changes by ajax jQuery in codeigniter

$('document').ready(function () { $('.js-example-basic-single').select2(); $('#empName').on('change', function() { var quan = $(this).val(); $.ajax({ url: '
1
vote
1 answer

Showing the count of my user and display it on badge. (Codeigniter)

Newbie here. I did an ajax to count the users and display it on my badge, however, whenever I'm clicking on 1 button (Modal with table), it is displaying on all badges. For example. I have 4 users in my first row modal table. The #4 count is…
Dark
  • 132
  • 1
  • 15
1
vote
1 answer

How to back db and truncate all tables in CodeIgniter?

I am using this code to backup data, how to truncate all tables in db? My function for backupdb public function export_db() { $this->load->dbutil(); $prefs = array( 'format' => 'zip', 'filename' =>…
Shambu
  • 73
  • 1
  • 9
1
vote
1 answer

Codeigniter batch update for checkbox

I have a situation like this, I want to update some data where the input are checkboxes, I was tried this code below. Data already saved in database, but data saved in another row, For example : I checked color red, yellow and grey for BirdA and I…
1
vote
2 answers

Codeigniter 4 Query Builder loses SELECT and WHERE condition while executing once more

I am using Codeigniter 4 Query Builder. Following is code to retrieve data from the database public function get_data() { $where = [ 'username' => 'admin' ]; $this->_builder =…
1
vote
2 answers

Codeigniter query builder does not work correctly

can someone explain the difference between these codes? Because the query builder does not give the correct result, but the other query gives the correct result. What is the difference that I cannot…
starlings
  • 411
  • 6
  • 12
1
vote
1 answer

How to get data from another table matching 2 fields to same 1 field from another table

I have 3 table Player Playerid Player name Team Team id Player1 foreign key playerid from table(player) Player2 foreiy key playerid Match Matchid Teamid Playerid Now I want a player name from the player table for player1 and player2 in Dropdown…
1
vote
1 answer

php - Codeigniter Increment

So I have this function that gets the total number of rows in a table. This is my Code: public function get_reservation() { $this->db->select('COUNT(*) as res_no '); $this->db->from('reservation_details'); $query =…
1
vote
2 answers

Consume a REST API in codeigniter controller

I have create a REST API and want to consume my own created API in codeigniter controller. My created REST API controller(example.php) class Example extends REST_Controller { public function __construct() { parent::__construct(); …
1
vote
1 answer

change userlevel on button click in codeigniter

I am trying to update userlevel when click on button. i have a page where it will display all users there i have change level button.by default every user will be in normal level(means 3) so when i click on a button it has to change to 5(lead ) and…
1
vote
2 answers

Accessing each data of the Result set i.e. $this->db->get(), on the model in Codeigniter

I have to get all the phone numbers of students from database and store in string variable with a comma in between them. I have tried the following but failed. This is my code below : $toNumbersCsv=""; …
1
vote
5 answers

How to use two foreach to insert data in database

I have two arrays from my view.I need to insert their data corresponding to each other. Below is the My view
1
vote
1 answer

get data date using <= codeigniter

I have data looking like this I want show all before 01-08-2018 record (included 01-08-2018) but currently need to fill in 02-08-2018, then able to found 01-08-2018 record ive tried get data like this this is my where…
1
vote
1 answer

get result by category id in codeigniter

I need to get the the subcategories of its categories in codeigniter. I am stuck at passing category id to the my model method my code is below : this is my view : index.php
1
vote
2 answers

Codeigniter count_all_results then get return error number 1066

I want to count all result by using $this->db->count_all_results() in my query then get the query result ($this->db->get) without reset any field value. i have followed the user guide on Limiting or Counting Results it's say However, this method…