codeigniter

how is output(echo) array without use of json_encode?(codeigniter)

时光怂恿深爱的人放手 提交于 2021-02-05 11:50:27
问题 for output array Instead of using json_encode, use of what.(how is output(echo) array without use of json_encode?) i use of codeigniter. CI_Controller: function auto_complete(){ $hotel_search = $this->input->post('search_hotel'); echo json_encode($this->model_tour->auto_complete($hotel_search)); // if use of json_encode output is '[{"name":"salal"},{"name":"salaso"},{"name":"salasi"},{"name":"salsh"}]' if don want use of json_encode output is "Array" } CI_model: function auto_complete($hotel

how to convert array value to string and save to database

自闭症网瘾萝莉.ら 提交于 2021-02-05 11:13:27
问题 I have trouble, how to save array value in database, Each time I enter data only the last data stored in the database. here is my code : Controller : function tambah_rm($id) { $this->load->helper('form'); $this->load->library('form_validation'); $data['title'] = 'Tambah Detail Rekam Medis'; $this->form_validation->set_rules('tgl_berobat', 'tgl_berobat', 'required'); $this->form_validation->set_rules('anamnesa', 'anamnesa', 'required'); $this->form_validation->set_rules('diagnosa', 'diagnosa',

Datebase error mysqli::real_connect(): (HY000/2002): Connection refused codeingiter

拜拜、爱过 提交于 2021-02-05 10:39:27
问题 $active_group = 'default'; $query_builder = TRUE; $db['default']['hostname'] = 'localhost'; $db['default']['username'] = '***********'; $db['default']['password'] = '***********'; $db['default']['database'] = '***********'; $db['default']['dbdriver'] = 'mysqli'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = FALSE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat

Codeigniter loop through post array

你。 提交于 2021-02-05 09:41:42
问题 So i have this form: <form id="stepform" action="#" method="post"> <fieldset> <legend>Step #1</legend> <label>Title</label> <input type="hidden" name="csrf_modo" value="b94961394f8e6f7efaa4e37ca9007822"> <input type="text" name="field[]" class="input-xlarge"> <label>Body</label> <textarea class="input-xlarge" name="field[]"></textarea> </fieldset> </form> When user clicks a button jquery dynamically appends another two exactly same fields: count = 2; $("#addstep").click(function(){ $('

Codeigniter loop through post array

孤者浪人 提交于 2021-02-05 09:41:02
问题 So i have this form: <form id="stepform" action="#" method="post"> <fieldset> <legend>Step #1</legend> <label>Title</label> <input type="hidden" name="csrf_modo" value="b94961394f8e6f7efaa4e37ca9007822"> <input type="text" name="field[]" class="input-xlarge"> <label>Body</label> <textarea class="input-xlarge" name="field[]"></textarea> </fieldset> </form> When user clicks a button jquery dynamically appends another two exactly same fields: count = 2; $("#addstep").click(function(){ $('

codeigniter add N in sql Query INSERT unicode text

久未见 提交于 2021-02-05 07:47:19
问题 I am working with codeigniter / SQL. Where I want to insert unicode string with 'N' Prefix the insert. How can I achieve it in regular insert. Regular Code: $data = array( 'title' => 'My title' , 'name' => 'My Name' , 'data' => 'My data' ); $this->db->insert('mytable', $data); INSERT Trying to Achieve: INSERT INTO mytable (title, name, data) VALUES ('My title','My Name',N'My data'); Is there any way to achive the above insert instead of manually writing the Query.? 回答1: This is the simplest

codeigniter add N in sql Query INSERT unicode text

送分小仙女□ 提交于 2021-02-05 07:47:06
问题 I am working with codeigniter / SQL. Where I want to insert unicode string with 'N' Prefix the insert. How can I achieve it in regular insert. Regular Code: $data = array( 'title' => 'My title' , 'name' => 'My Name' , 'data' => 'My data' ); $this->db->insert('mytable', $data); INSERT Trying to Achieve: INSERT INTO mytable (title, name, data) VALUES ('My title','My Name',N'My data'); Is there any way to achive the above insert instead of manually writing the Query.? 回答1: This is the simplest

CodeIgniter with encrypted URLs

对着背影说爱祢 提交于 2021-02-05 06:42:26
问题 I want to use codeigniter framework for my project but I dont want it readable, so i have to encrypt url like: http://myproject.com/index.php/indexcontroller/myaction/ into: http://myproject.com/as79d8a7sd9a8sd7a98d7a9s8d790akmwmwm97aw I dont know how to achieve such scenario. How controller and methods will be called and how it will be performed. Please guide me. 回答1: This sounds like a job for URI routing! Add this to your config/routes.php : $route['(:any)'] = "MyController/MyFunc/$1"; Now

CodeIgniter with encrypted URLs

微笑、不失礼 提交于 2021-02-05 06:42:08
问题 I want to use codeigniter framework for my project but I dont want it readable, so i have to encrypt url like: http://myproject.com/index.php/indexcontroller/myaction/ into: http://myproject.com/as79d8a7sd9a8sd7a98d7a9s8d790akmwmwm97aw I dont know how to achieve such scenario. How controller and methods will be called and how it will be performed. Please guide me. 回答1: This sounds like a job for URI routing! Add this to your config/routes.php : $route['(:any)'] = "MyController/MyFunc/$1"; Now

How to disable redirecting when clicking on a button?

老子叫甜甜 提交于 2021-02-05 06:41:06
问题 I use Codeigniter and Bootstrap. I have a button: <a class="btn btn-success" id="btnid" href="http://site/controllerName/parameter">Text</a> If I click to the button its call a controller with one parameter then the controller redirects to a site. My question is that is there a way to call the controller with a parameter but skipping the redirection? 回答1: Try following $(document).ready(function(){ // Add your event handlers inside ready block $("#btnid").click(function(event) { // button