codeigniter

Insert multiple rows into DB using one form

拟墨画扇 提交于 2020-06-17 02:51:56
问题 I am using Codeigniter MVC framework, I am trying to insert 14 rows into DB. Also, I have 14 calls for the model in my controller. However somehow, it inserts only Sunday morning. Why is that? * The view I posted is just a small part that just repeats itself for each day (Monday-Sunday) and (Morning, Evening). My DB looks like this: +---------+---------+--------+ | day | time | user_id| +---------+---------+--------+ | Sunday | morning | 1 | +---------+---------+--------+ | Monday | evening |

CodeIgniter COUNT with active record?

喜你入骨 提交于 2020-06-16 02:48:29
问题 I am working in codeigniter.. I want to count the no. of rows having the same order_no.. below is my code. public function get_my_orders() { $user_data = $this->session->all_userdata(); $email = $user_data['user_email']; $this->db->select('*'); $this->db->from('order_details'); $this->db->where('email', $email); $this->db->group_by('order_no'); $this->db->order_by('order_no', 'DESC'); $query = $this->db->get(); return $query->result(); } Pls help.. 回答1: Try changing your select line to look

CodeIgniter Active Record Delete Multiple Records At Once

不想你离开。 提交于 2020-06-16 02:37:50
问题 This is one of my controller functions. It grabs all the rows from a database table called 'users' and puts it into an array. It then loads a view called 'deleteuser' with the array data passed through. function deleteuser(){ $this->load->model('users'); $employees['staff'] = $this->users->getStaff(); $this->load->view('deleteuser', $employees); } In the deleteuser view, there's a checkbox type input generated from the array. The form action calls on a function called remove. <form action=

Codeigniter xml file not uploading

家住魔仙堡 提交于 2020-06-13 04:59:09
问题 When trying to upload an XML file in Codeigniter. I am working with eFax, trying to set up Inbound Fax Delivery: Enabling XML Posting. I am getting the following error anytime I do a test post using their Sample.xml file they have provided: The filetype you are attempting to upload is not allowed. Other documents will upload fine. In my upload config, xml is set in the options for allowed_types : $config['allowed_types'] = 'txt|xml'; Why does Codeigniter not allow the eFax XML document type?

Codeigniter xml file not uploading

你离开我真会死。 提交于 2020-06-13 04:59:07
问题 When trying to upload an XML file in Codeigniter. I am working with eFax, trying to set up Inbound Fax Delivery: Enabling XML Posting. I am getting the following error anytime I do a test post using their Sample.xml file they have provided: The filetype you are attempting to upload is not allowed. Other documents will upload fine. In my upload config, xml is set in the options for allowed_types : $config['allowed_types'] = 'txt|xml'; Why does Codeigniter not allow the eFax XML document type?

MySQL Join and create new column value

余生长醉 提交于 2020-06-13 00:10:09
问题 I have an instrument list and teachers instrument list. I would like to get a full instrument list with id and name. Then check the teachers_instrument table for their instruments and if a specific teacher has the instrument add NULL or 1 value in a new column. I can then take this to loop over some instrument checkboxes in Codeigniter, it just seems to make more sense to pull the data as I need it from the DB but am struggling to write the query. teaching_instrument_list - id - instrument

Wait for AJAX before continuing through separate function

本小妞迷上赌 提交于 2020-06-09 12:11:50
问题 Alright... at 2am, this is where I draw the line. Help... before my laptop ends up going out the window. :) I've tried using setTimer, callbacks, and everything else I can think of (along with a few other Stackoverflow hints of course). I've stripped out everything so I'm leaving just the base code. What I'm looking to do is call parseRow() and before it saves the record at the end, I need to grab the associated Category (via AJAX); however, it blows right past it so category is always

Codeigniter error message Cannot modify header information

旧城冷巷雨未停 提交于 2020-06-09 02:52:12
问题 I got this error message when i run my php CodeIgniter project: A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\tree\application\models\mtree.php:17) Filename: core/Common.php Line Number: 442 line 17: echo $row->members_id . "</br>"; this is my model function: function convert_all() { $this->db->empty_table('table1'); $this->db->empty_table('table2'); $this->db->query("INSERT INTO `table1` (

Codeigniter error message Cannot modify header information

不问归期 提交于 2020-06-09 02:51:06
问题 I got this error message when i run my php CodeIgniter project: A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\tree\application\models\mtree.php:17) Filename: core/Common.php Line Number: 442 line 17: echo $row->members_id . "</br>"; this is my model function: function convert_all() { $this->db->empty_table('table1'); $this->db->empty_table('table2'); $this->db->query("INSERT INTO `table1` (

CodeIgniter get_where

萝らか妹 提交于 2020-06-08 08:08:23
问题 I’m attempting to use get_where to grab a list of all database records where the owner is equal to the logged in user. This is my function in my controller; function files() { $owner = $this->auth->get_user(); $this->db->get_where('files', array('owner =' => '$owner'))->result(); } And in my view I have the following; <?php foreach($query->result() as $row): ?> <span><?=$row->name?></span> <?php endforeach; ?> When I try accessing the view, I get the error : Fatal error: Call to a member