codeigniter-3

codeigniter 3 database connection with third party Database

主宰稳场 提交于 2019-12-12 01:42:08
问题 I am trying to connect database using codeigniter 3 but i am facing this issue anybody please help. A PHP Error was encountered Severity: Warning Message: mysqli::real_connect(): (HY000/2005): Unknown MySQL server host 'pd8344-001.privatesql' (2) Filename: mysqli/mysqli_driver.php Line Number: 202 Backtrace: File: /var/www/html/importdb/index.php Line: 292 Function: require_once And A Database Error Occurred Unable to connect to your database server using the provided settings. Filename: core

How to display the child record related to the parent record?

穿精又带淫゛_ 提交于 2019-12-12 00:02:42
问题 I am using CodeIgniter and data table with child row. I have a table and records are: - id| Name | role | leaders 1 | A | 1 | 1 2 | B | 2 | 1 3 | C | 2 | 1 4 | D | 3 | 2 5 | E | 3 | 2 6 | F | 4 | 3 7 | G | 4 | 3 Note : leaders value are the id value. Now I have to display the parent records which the role is 1,2,3. Like I have Name A,B,C,D,E with roles are 1,2,2,3,3 A, B, C, D, E records are displaying like parent records and I have to display the child record related to the leader's id.

How to check the array value in if condition?

梦想与她 提交于 2019-12-11 19:45:04
问题 I am using codeignator and I am getting the multiple value in the array. $status = $this->input->post('Status[]'); print_r($status); Output is Array ( [0] => 1 [1] => 7 [2] => 8 [3] => 7 ) It will increase and value will be duplicate like 7. Now I have to check each array value. so I tried if (($status=1)||($status=3) || ($status=6) || ($status=8)|| ($status=9)) { $remark = $this->input->post('remark[]'); } else{$remark="";} if(($status=2)||($status=4) || ($status=5)){ $reasonDate = $this-

How to check the id is booked of for specific days?

徘徊边缘 提交于 2019-12-11 17:57:06
问题 I have a table and records are like below table. id | list_id |venue_id |name | start_date | end_date |start_time |end_time | days 1 | 1 | 1 |asdf | 2019-02-02 14:05:54| 2019-02-28 14:05:54|05:30 |10:00 | 1,2,3 2 | 7 | 2 |awed | 2019-02-10 15:02:24| 2019-02-20 15:02:24|07:30 |14:00 | 2,5 3 | 7 | 1 |mjgd | 2019-02-04 09:05:54| 2019-02-13 09:05:54|09:30 |18:00 | 4 Now What I am doing is I have to check the start_time and end_time range if found in the range then check start_date and end_date

codeigniter active records group_by returns random ordering of joined table record id

百般思念 提交于 2019-12-11 17:25:29
问题 I'm using Codeigniter, what I want to do is a query that returns joined table (item_gallery) gallery_id is lowest value. while main query ordered by desc of items post_date the below code group_by select random value of item_gallery gallery_id. but i want the lowest value of item_gallery gallery_id. public function shopItems($id) { $this->db->select("*"); $this->db->from('items'); $this->db->join('item_gallery', 'items.id = item_gallery.item_id', 'left'); $this->db->where('items.user_id', $id

Session not working on CodeIgniter

邮差的信 提交于 2019-12-11 17:25:23
问题 Hi guys my session is not working on CodeIgniter, please help.. Following is my config $config['sess_driver'] = 'database'; $config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_save_path'] = 'ci_sessions'; $config['sess_match_ip'] = FALSE; $config['sess_time_to_update'] = 300; $config['sess_regenerate_destroy'] = FALSE; I am setting like as follows $this->session->set_userdata('test', "Hello world!"); And trying to retrieve as follows and it prints

How to get the records of multiple ids along with next year fees data and display on the view page

半世苍凉 提交于 2019-12-11 16:59:31
问题 I am struggling for an idea or logic to solve my issue. I am stuck now. My issue is, I am getting the multiple member_id and sending to model to get the related records from the table and also to check the duration of each member if the duration is 2018-2019 then display the records of the next year 2019-2020 which is on another table. I have to display the list like Member one information related records Member two information related records and so on Explanation in details I have three

Validate recaptcha ajax and codeigniter

烈酒焚心 提交于 2019-12-11 16:58:34
问题 I am using Codeigniter and Ajax to validate and submit the email form. I tried many methods, it keeps giving me the result {"sent":false} it was working great before I add the recaptcha lines. here is my code: custom.script.js $("#ajax-contact-form").submit(function() { var href = 'http://localhost:8888/en/send'; var name = $("#form-name").val(); var email = $("#email").val(); var phone = $("#phone").val(); var title = $("#form-title").val(); var message = $("#form-message").val(); $.ajax({

Loading view inside a Library, issues with cached vars

我们两清 提交于 2019-12-11 16:08:03
问题 I am trying to implement a widgets library using load->view. I know I can use include to call directly the file and avoid the vars cache issues but just wondering why it does not work. Here is how I have structured my code: My Controller: class Page extends MY_Controller { public $data = array(); public function __construct() { parent::__construct(); ... $this->load->library('widgetmanager'); } public function index($slug = '') { echo $this->widgetmanager->show(2); echo $this->widgetmanager-

How to download an uploaded image in PHP Codeigniter

流过昼夜 提交于 2019-12-11 15:16:34
问题 I have uploaded an image and then applied rotation operation on the image and fetch the flipped image in other view, now how to download that flipped image please guide me? View code for uploading image: <input type='file' name="userfile" size="20"> <input type="submit" name="upload" value="Flip"> Controller code for flip: $data['title'] ='Flip Image'; $upload['upload_path'] = './assets/images/'; $upload['allowed_types'] = 'gif|jpg|jpeg|png'; $this->load->library('upload',$upload); $filedata1