Questions tagged [codeigniter-database]

8 questions
2
votes
1 answer

CodeIgniter multiple db connection not fetching data from second db

One is the default and the other one is the second DB which I need only in few controllers to maintain the orders coming through the system. Here is the code, my database.php file is as follows: Here is my configuration: `$db['default'] =…
0
votes
1 answer

I want insert data into two tables with same id in codigIgnitor

My CI_Controller public function insert() { $insert1 = array('reg_name'=>$this->input->POST("name"), 'reg_mob'=>$this->input->POST("mobile"), 'reg_address'=>$this->input->POST("address")); $insert2 =…
ankita
  • 1
0
votes
2 answers

Displaying values in select box dynamically is not working in codeigniter

I am trying to get values in select box as dynamic is not working here is the my controller code below: public function CreateNewAsset() { $data['courselist'] = $this->Dashboard_model->getDashboardCourses(); …
user200
  • 291
  • 1
  • 4
  • 21
0
votes
2 answers

how to get array's data in a blank array if condition is true using foreach

I have an array : $stu_result( [exam_type] => 1 [subject_id] => 5 [converted_mark] =>5.00[student_id] => 186 [sub_name] => maths) and its length is 15. I want to match exam type and store sub_name and converted marks in a blank array. I tried this…
0
votes
1 answer

How to convert this SQL Query on Code Igniter Model

Good Day Masters, Can anyone help me how to convert this SQL Query into Code Igniter format (model). SELECT firstName, FLOOR(DATEDIFF(CURRENT_DATE, birthDate)/365.25) as age FROM residents_tbl WHERE FLOOR(DATEDIFF(CURRENT_DATE, birthDate)/365.25)…
0
votes
1 answer

connect to db using the db name from the custom config name

In my application/config/config.php I have this custom config item $config['roles_permissions_db'] = 'roles_permissions'; and I'm trying to connect to a db using $CI =&…
Juliver Galleto
  • 8,831
  • 27
  • 86
  • 164
-1
votes
1 answer

CodeIgniter 3 not returning false in case of a DB query error

I have read as many related answers on SO related to this error I'm getting. However, NO question (or answer) is about CodeIgniter's DB active query class returning FALSE when it SHOULD (since an error occurred). All it does is print the query error…
nvkrj
  • 1,002
  • 1
  • 7
  • 17
-1
votes
5 answers

A non-numeric value encountered mysqli

A non-numeric value encountered on line number 51 means this line it show me an error non-numeric value ->update('purchase',array('item_qty'=>'item_qty'+$item_qty)); function upd_sales($upd_sales) { $item_name=$upd_sales['item_name']; …