codeigniter

codeigniter inner join error

早过忘川 提交于 2019-12-24 20:56:16
问题 I want to equal some table with Inner Join in Codeigniter. But I give some errors. I put below some codes in my controller. But I give an error like that: A Database Error Occurred Error Number: HY000/1096 No tables used SELECT * Filename: C:/xampp/htdocs/erp/system/database/DB_driver.php Line Number: 691 My Controller Inner Join Here: public function edit($cusId) { $this->lang->load('content', $this->session->userdata('people_lang')); $viewData = new stdClass(); $viewData->customer = $this-

CodeIgniter 3.x - Reload View with Different CSS File Using User Input

两盒软妹~` 提交于 2019-12-24 20:50:27
问题 Problem: I created a static page view (in its own view folder) that demos the new Sakura.css framework. The framework comes with four CSS themes. I want to be able to select a theme from a list of links and reload the same view with the associated CSS theme file via the controller. I also need the view to default to the 'standard.css' theme. Finally, I'd like to avoid JavaScript/jQuery solutions. I'm struggling to grasp the relationship between controller function names, custom routing, and

Get peer column values from same table using Codeigniter and MySQL

杀马特。学长 韩版系。学妹 提交于 2019-12-24 20:34:01
问题 How can I get peer column values if parent id matches. In the below example, I'll give subcat_id as 42 and based on cat_id(6) it should give me 41 and 43. cat_id----subcat_id---name =========================== 5---------40----------ABC 6---------41----------DEF 6---------42----------GHI 6---------43----------JKL Thanks. 回答1: Is this what you are looking at. Also I would suggest to have a primary key in the table. select t2.cat_id , t2.subcat_id, t2.name from test t1 join test t2 on t1.cat_id

Codeigniter: Check and force one page to https://

不想你离开。 提交于 2019-12-24 20:32:44
问题 I want most of my site to be http:// but for a single checkout page to be https:// How can I check and switch the user to https:// so there's no chance they can use it with http://? 回答1: You can force SSL for specific URLs using .htaccess rules. In this example, if someone visits any of the register/payment directories, they will be redirected to the https:// URL. RewriteEngine on RewriteCond %{SERVER_PORT} 80 RewriteCond $1 ^(register/payment|login) RewriteRule ^(.*)$ https://www.yourdomain

CodeIgniter: set_checkbox problem

[亡魂溺海] 提交于 2019-12-24 20:25:39
问题 I seem to be running into something really nasty: I have a form which contains a group of checkboxes. I have set up validation rules for my form, and just added an empty one for my checkbox group. However, after validating my form and giving an error, it only rechecks the last one in the group that was selected. This is just driving me nuts, since the user will never notice it was unchecked! for now, before building up the system, I just hardcoded the form to check if it works how I want it

inserting multiple rows in database on codeigniter [duplicate]

非 Y 不嫁゛ 提交于 2019-12-24 20:23:14
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: insert multiple rows via a php array into mysql i am trying to insert only filled data in to the database. my controller $code=$_POST['code']; $rate=$_POST['rate']; $quantity=$_POST['quantity']; //$total=$_POST['rate']*$_POST['quantity']; $count = count($_POST['code']); for($i=0; $i<$count; $i++) { $data = array( 'shop'=>$shop->$this->input->post('shop'), 'code' => $code[$i], 'rate' => $rate[$i], 'quantity' =>

CODEIGNITER how to insert user_ID to mySQL when that user_ID is logged in

心不动则不痛 提交于 2019-12-24 19:36:55
问题 this is the error page Cannot add or update a child row: a foreign key constraint fails ( latihan_ci . adventure , CONSTRAINT adventure_ibfk_1 FOREIGN KEY ( user_id ) REFERENCES users ( user_id ) ON UPDATE CASCADE) INSERT INTO adventure ( name , category , place , state ) VALUES ('semeru', 'gunung', 'asa', 'asd') and this is my controller public function addTrip(){ $this->load->model('userModel'); $newTrip = ['name' => $this->input->post('name'), 'category' => $this->input->post('category'),

CodeIgniter 404 Bad request error

独自空忆成欢 提交于 2019-12-24 19:31:12
问题 I'm working with codeIgniter. I am making a login form which checks the members details with the database. However when I click to login I get this error message: The requested URL /waitronmain/login.php/login/validate_credentials was not found on this server. However this is my login.php file and as you can see validate_credentials() does exist. class Login extends CI_Controller{ function index() { $data['main_content'] = 'login_form'; $this->load->view('includes/template', $data); }

Pagination and search displaying all records on each page

天大地大妈咪最大 提交于 2019-12-24 19:28:47
问题 I'm using codeigniter 2.1.4 and i'm trying to display all the users files on a page with pagination of 5 records per page. The pagination links work but every link shows all the records. My Model public function get_user_files($user_id, $keyword = NULL) { $select = array( 'files.name as filename', 'files.id, files.remarks', 'boxes.id as box_id', 'boxes.bin_id as bin_id', 'box_types.name as box_type', 'companies.name as companyname' ); $from = array('files','boxes','box_types','companies');

redirecting-to/adding www in url codeigniter based project

旧城冷巷雨未停 提交于 2019-12-24 19:09:53
问题 I am trying to add www and redirect all non-www urls to www urls in a codeigniter-based project, but my post data is not working after doing so. Here is the content of the Apache .htaccess file: RewriteCond %{HTTP_HOST} ^examplesite\.com$ [NC] RewriteRule ^(.*)$ http://www.examplesite.com/$1 [R=301,L] I have $config['uri_protocol'] = 'AUTO'; . Everything works like a charm if I do not have www urls. I have tried REQUEST_URI , but it didn't work either. 回答1: This is because browsers wont