codeigniter

Codeigniter GROUP_CONCAT

强颜欢笑 提交于 2021-02-04 21:15:27
问题 I have: $this->db->select('GROUP_CONCAT(prod_poster, poster2, poster3, poster4, poster5, poster6, poster7)'); And I have error for this and shows sql query: SELECT GROUP_CONCAT(prod_poster, `poster2`, `poster3`, `poster4`, `poster5`, `poster6`, `poster7)` it's problem because of ->>>> ` near poster7. this symbol must be inside bracket. whyc codeigniter do like this? and how to fix it? 回答1: Try doing: $this->db->select('GROUP_CONCAT(prod_poster, poster2, poster3, poster4, poster5, poster6,

Codeigniter GROUP_CONCAT

帅比萌擦擦* 提交于 2021-02-04 21:13:06
问题 I have: $this->db->select('GROUP_CONCAT(prod_poster, poster2, poster3, poster4, poster5, poster6, poster7)'); And I have error for this and shows sql query: SELECT GROUP_CONCAT(prod_poster, `poster2`, `poster3`, `poster4`, `poster5`, `poster6`, `poster7)` it's problem because of ->>>> ` near poster7. this symbol must be inside bracket. whyc codeigniter do like this? and how to fix it? 回答1: Try doing: $this->db->select('GROUP_CONCAT(prod_poster, poster2, poster3, poster4, poster5, poster6,

Get last updated data - Codeigniter

人盡茶涼 提交于 2021-02-04 19:50:07
问题 I am working in codeigniter, i have a below table of schemes, my problem is i want to show last updated data of each scheme. I dont know how to do that, please help. my_table scheme_code updated_on scheme_name 1 2015-04-13 One 3 2015-04-12 Three 4 2015-04-13 Four 3 2015-04-10 Three 3 2015-04-8 Three 1 2015-04-10 One 4 2015-04-11 Four My Model function show_last_updated_data(){ $this->db->select('*'); $this->db->from('my_table'); $this->db->order_by('updated_on', 'DESC'); $query = $this->db-

Get last updated data - Codeigniter

假如想象 提交于 2021-02-04 19:49:27
问题 I am working in codeigniter, i have a below table of schemes, my problem is i want to show last updated data of each scheme. I dont know how to do that, please help. my_table scheme_code updated_on scheme_name 1 2015-04-13 One 3 2015-04-12 Three 4 2015-04-13 Four 3 2015-04-10 Three 3 2015-04-8 Three 1 2015-04-10 One 4 2015-04-11 Four My Model function show_last_updated_data(){ $this->db->select('*'); $this->db->from('my_table'); $this->db->order_by('updated_on', 'DESC'); $query = $this->db-

Codeigniter, increase database value by value contained in variable

可紊 提交于 2021-02-02 09:16:37
问题 I am using codeigniter, and I have the following function in my model to give points to the user. It is however not working, rather setting the points column to 0. This is how it is written in the codeigniter manual. Therefore I have no clue why it is not working... Thanks function give_points($username,$points) { $this->db->set('points', 'points + $points'); $this->db->where('username', $username); $this->db->update('users'); echo"done"; } 回答1: I believe you have to tell CI specifically to

Codeigniter, increase database value by value contained in variable

廉价感情. 提交于 2021-02-02 09:13:16
问题 I am using codeigniter, and I have the following function in my model to give points to the user. It is however not working, rather setting the points column to 0. This is how it is written in the codeigniter manual. Therefore I have no clue why it is not working... Thanks function give_points($username,$points) { $this->db->set('points', 'points + $points'); $this->db->where('username', $username); $this->db->update('users'); echo"done"; } 回答1: I believe you have to tell CI specifically to

how to include the codeigniter websocket library correctly?

白昼怎懂夜的黑 提交于 2021-01-29 22:18:16
问题 I found this library to use web-socket protocol in code-igniter codeigniter-websocket and I did all the steps. I even make the same example in the description and I got this Error An Error Was Encountered Unable to load the requested class: Codeigniter_websocket 回答1: It was a bug of that package. It does not load the package library due to incorrect vendor path. This bug has been fixed. Codeigniter WebSocket Library has been updated. Please Update the library. If you face installation problem

How can I detect a create, update, delete query is successful in Codeigniter

自古美人都是妖i 提交于 2021-01-29 22:16:21
问题 I am currently writing a controller method like this: public function delete($user_id) { if ($this->input->server('REQUEST_METHOD')=='POST') { $result = $this->Crm_user_model->update($user_id, array('deleted'=>true)); if($result) { add_flash_message('info', 'deleted'); } else { add_flash_message('alert', 'can not delete'); } //redirect('user/view'); } } But all result return nothing, even the database(mssql) is changed. How can I know that the update query is success or not? 回答1: In crm_user

How can I detect a create, update, delete query is successful in Codeigniter

狂风中的少年 提交于 2021-01-29 21:10:58
问题 I am currently writing a controller method like this: public function delete($user_id) { if ($this->input->server('REQUEST_METHOD')=='POST') { $result = $this->Crm_user_model->update($user_id, array('deleted'=>true)); if($result) { add_flash_message('info', 'deleted'); } else { add_flash_message('alert', 'can not delete'); } //redirect('user/view'); } } But all result return nothing, even the database(mssql) is changed. How can I know that the update query is success or not? 回答1: In crm_user