codeigniter-3

Codeigniter array backend validation

杀马特。学长 韩版系。学妹 提交于 2019-12-20 04:16:27
问题 I'm using a form, inside which contains a div with a pair of input field which is added dynamically. VIEW: <?php echo form_open_multipart('location/add'); ?> <div> <input type="text" name="title[]"/> <div id="infoMessage"><?php echo form_error('title[]'); ?></div> </div> <div> <input type="text" name="desc[]"/> <div id="infoMessage"><?php echo form_error('desc[]'); ?></div> </div> <div> <input type="text" name="link[]"/> <div id="infoMessage"><?php echo form_error('link[]'); ?></div> </div>

Combine array with same element value and keep them all together, comma separated

为君一笑 提交于 2019-12-19 10:52:33
问题 I have a Multi-dimensional array [0] => Array ( [name] => Size [value] => XS,S,XL ) [1] => Array ( [name] => Brand [value] => Adidas ) [2] => Array ( [name] => Size [value] => XS,XL,L,M ) [3] => Array ( [name] => Brand [value] => Nike ) i want result as [0] => Array ( [name] => Size [value] => S,M,L,XS,XL ) [1] => Array ( [name] => Brand [value] => Adidas,Nike ) I'm trying to array_combine , array_merge and even array_unique with no success 回答1: You can try this - $array = array( '0' => array

How to load CS, JS dynamically in CodeIgniter?

守給你的承諾、 提交于 2019-12-19 04:09:34
问题 I have different CSS and JS files related to different views. How to load CSS and JS conditionally or dynamically according to views so that only the respective JS or CSS loads to the browser? 回答1: It's simple. Just create condition on your function. Then send your CSS or JS file location to view. Controller: public function index() { // conditional if (your condition) { $this->data = array( 'css' => site_url() . "your css file", 'js' => site_url() . "your js file" ); } else { $this->data =

How to install Doctrine in CodeIgniter 3

夙愿已清 提交于 2019-12-18 00:48:30
问题 The official guide is not complete, and others are for CI2. So i give you a tutorial i myself checked is working. I know SO encourage users to answer their own questions. 回答1: Install Doctrine (The following instructions are modified from: Doctrine 2 ORM’s documentation - Installation and Configuration) Doctrine can be installed with Composer: From your command line (e.g. Windows: Start > cmd), change to the folder where the files should be installed (e.g. htdocs/my_project). Use Composer to

Codeigniter Transactions

社会主义新天地 提交于 2019-12-17 05:53:07
问题 I'm using Codeigniter transactions $this->db->trans_start(); $this->db->query('AN SQL QUERY...'); $this->db->trans_complete(); This works fine , the problem I have is that inside the trans_start and trans_complete I'm calling other functions and those functions deals with database so they contains inserts and update and some deletes ... ex: $this->db->trans_start(); $this->utils->insert_function($data); $this->utils->update_function2($test); $this->db->trans_complete(); Now if those functions

how to print array object data into array data in php codeigniter

天涯浪子 提交于 2019-12-14 03:58:18
问题 I have array object data coming below format.I want to echo data as i given example html data. I tried different array function,finally not get result can you please check and give me solution please.My out put data is below format. echo "<pre>";print_r($passenger_info); exit(); Out put is below. Array ( [0] => stdClass Object ( [pass_id] => 12815 [AL_RefNo] => H181100000133 [passenger_type] => adult [title] => Mr. [first_name] => Chitta [middle_name] => [last_name] => user [gender] => [child

Ajax Call Repeat Post Data

断了今生、忘了曾经 提交于 2019-12-14 03:06:16
问题 I am having trouble while posting data using Ajax. I am using checkboxes and send the checked box value to PHP page. While I first click then the query I Got is like: SELECT * FROM `product` INNER JOIN `p_attributes` ON `product`.`product_id`=`p_attributes`.`product_id` WHERE `p_attributes`.`color_g` = 1 But when I second time click on other check box without unchecked the first one the I got this Query: SELECT * FROM `product` INNER JOIN `p_attributes` ON `product`.`product_id`=`p_attributes

Css and Js files does not load in MVC CI

时光总嘲笑我的痴心妄想 提交于 2019-12-13 23:06:14
问题 Header.php <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="/Contents/css/bootstrap.min.css" rel="stylesheet"> <link href="/Contents/fonts/css/font-awesome.min.css" rel="stylesheet"> <link href="/Contents/css/animate.min.css" rel="stylesheet"> <link href="/Contents/css/custom.css

Codeigniter search engine BUG: results pagination items display ALL the posts

天大地大妈咪最大 提交于 2019-12-13 18:43:16
问题 I am working on a basic blog application with Codeigniter 3.1.8. and Bootstrap 4. The application has a search posts functionality. The form in the header view: <form method="get" action="<?php echo base_url('posts/search') ?>" id="search_form" class="w-100 py-1 px-2 px-md-3 px-lg-5" accept-charset="utf-8"> <div class="input-group <?php if(form_error('search')) echo 'has-error';?>"> <input class="form-control form-control-dark" type="text" name="search" placeholder="Search posts..." aria

How to get value from URL in CodeIgniter?

大憨熊 提交于 2019-12-13 10:29:34
问题 I had a url http://localhost/tasty/index.php/admin/edititems?id=20 . I have to get the value 20 . 回答1: You can do this: $this->input->get('id', TRUE); I'd recommend checking out the docs here: http://www.codeigniter.com/user_guide/libraries/input.html 来源: https://stackoverflow.com/questions/37042468/how-to-get-value-from-url-in-codeigniter