codeigniter

insert radio value multiple data codeigniter in database to one row?

若如初见. 提交于 2020-01-04 05:32:11
问题 I have a quiz online project i want the answer save like this in database +-----------+-------------+---------+-------------+ | id_answer | id_student | id_kuis | answer | +-----------+-------------+---------+-------------+ | 1 | 99999874465 | 7 | A,B,D,A,C,B | +-----------+-------------+---------+-------------+ this quiz is multiple choice. So how can i insert the data of answer like that. here's my view <?php echo form_open('c_kuis/addKuisAnswer',$atribut); ?> <?php foreach($soalPG as $row)

Codeigniter : Resetting the form values

随声附和 提交于 2020-01-04 05:26:25
问题 In my view, what I want to do is clear the form fields once the user has been successfully registered. Everything works fine here i.e. the user is being registered, success message is being shown to the user except that what I want to do is the clear the values of the form fields, for which I am using this // Clear the form validation field data, so that it doesn't show up in the forms $this->form_validation->_field_data = array(); After I added this, CI keeps giving me this error: Fatal

codeigniter - pyrocms intercept and modify all queries; extending active record

淺唱寂寞╮ 提交于 2020-01-04 04:14:18
问题 Is there a way to catch all queries and modify them before being sent to the db outside of modifying DB_active_record.php ? This would be ideal, though I'm not averse to modifying this file if it's the only option. I could just call this stuff from the models, but would feel better if this was something that was done in the background so as not to leave room for forgetting when and where it's happening; it'd be best to have it done in the background. I'm using a library to encrypt query data.

How to return last record from database in codeigniter?

感情迁移 提交于 2020-01-04 04:06:42
问题 I am trying to get the last date for which I have the data. So I want to print the last date in my column date_data. In Model: public function last_record() { $query = $this->db->select('LAST(date_data)'); $this->db->from('date_data'); return $query; } In Controller: $last_data = $this->attendance_m->last_record(); var_dump($last_data); But I am not getting the desired result 回答1: Try this $query = $this->db->query("SELECT * FROM date_data ORDER BY id DESC LIMIT 1"); $result = $query->result

CodeIgniter Database Query using query() with IN clause

那年仲夏 提交于 2020-01-04 03:49:27
问题 I have the following code in my model: $sql = "SELECT t1.*, t2.* FROM Table1 t1 INNER JOIN Table2 t2 ON t1.id = t2.id AND t2.title IN (?) AND t1.type = ? ORDER BY t1.id"; $q = $this->db->query( $sql, array( $filter, $type ) ); The problem is that this query works fine if: $filter = 'a'; But returns nothing if: $filter = "'a','b','c','d'"; For the second case I can see that CI is escaping the $filter like this: SELECT t1.*, t2.* FROM Table1 t1 INNER JOIN Table2 t2 ON t1.id = t2.id AND t2.title

how to create multidimensional array / object in jquery and pass via AJAX post

亡梦爱人 提交于 2020-01-04 02:46:10
问题 I am creating an order form that has a table of order items users can purchase. The inputs are using data attributes to store the items name and price per piece like so: <input type="text" class="input-small quantity-input" data-pid="<?php echo $p['id']; ?>" data-min="<?php echo $p['min_qty']; ?>" data-max="<?php echo $p['max_qty']; ?>" data-price="<?php echo $p['price']; ?>" data-name="<?php echo $p['product_name']; ?>" placeholder="quantity..."> I have everything figured out except for how

CodeIgniter “The page you requested was not found.” error?

假如想象 提交于 2020-01-04 01:36:26
问题 I'm having a problem with CodeIgniter. I've checked every possible solution on the internet and seems like nothing helps in my case. I'm not a big pro and it's my first time using CodeIgniter so don't be harsh with me. routes.php: $route['default_controller'] = "page"; $route['404_override'] = ''; $route['(:num)'] = "page/index/$1"; page.php: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Page extends CI_Controller { public function index($id=null) { $this-

understanding the load_class in CodeIgniter

扶醉桌前 提交于 2020-01-04 01:21:53
问题 im trying to understand the framework structure in CodeIgniter and i have just started and came up with this little misunderstanding . so can somebody please help me under stand the following :- 1- why do they use a reference to pass an instance of the class ... i mean why not just a simple variable ? 2- and why does the function store the name of the class in an array instead of a "string variable" (please dont judge my php terms as im the worst at it ).. ?! static $_classes = array(); ^^^^^

understanding the load_class in CodeIgniter

巧了我就是萌 提交于 2020-01-04 01:21:01
问题 im trying to understand the framework structure in CodeIgniter and i have just started and came up with this little misunderstanding . so can somebody please help me under stand the following :- 1- why do they use a reference to pass an instance of the class ... i mean why not just a simple variable ? 2- and why does the function store the name of the class in an array instead of a "string variable" (please dont judge my php terms as im the worst at it ).. ?! static $_classes = array(); ^^^^^

Codeigniter pagination link go to 404 Page Not Found

你。 提交于 2020-01-04 01:19:13
问题 I had this Paginate with search result implemented into my CI project, However I was unable to have my paginate links go to the next page, for example: my search page when it first loaded is http://localhost/ci_project/search , when I clicked the paging link which will go to http://localhost/ci_project/search/2 , the page is shown 404 Page Not Found . Can someone please help me to figure out what's wrong in my code? I tried a lot of suggestion on the solution but can't help, most of the issue