codeigniter

How to set codeigniter for apache server?

試著忘記壹切 提交于 2021-01-28 05:10:10
问题 Updated , I'm having some issues with deploying codeigniter project on Ubuntu server, i get 404 Apache error when i click on links. When i put the project in http://roy.my-domain.com/ = /var/www/html/ folder - it's all works fine - but when i added sub directory http://roy.my-domain.com/roy/ = /var/www/html/roy/ - i get 404 errors . When my url is http://roy.my-domain.com/roy/index.php/about - i get codeigniter 404 error and not apache2. The error : Not Found The requested URL /index.php was

Not Equal to Comparison in Codeigniter Active records

久未见 提交于 2021-01-28 05:03:45
问题 I am quite confused with this error which i am receiving with this code $this->db->order_by('uid','DESC')->where('type!=',"Admin")->get('user_profile',$config['per_page'], $this->uri->segment(3)); Here is what I get the Error Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Admin' ORDER BY `uid` DESC LIMIT 10' at line 3 SELECT * FROM (`user_profile`) WHERE `type!=` 'Admin' ORDER BY `uid`

File upload in codeigniter using ajax

筅森魡賤 提交于 2021-01-28 05:02:11
问题 I am trying to upload file using ajax in codeigniter framework. My code work without using ajax but when i use ajax i got error message 'Undefined index: picture'in if($_FILES['picture']['name']). Please check this code View : <form enctype="multipart/form-data" method="post"> <div class="form-group"> <label for="int">Picture</label> <input type="file" id="picture" name="picture" class="dropify" data-height="300" /> </div> </form> AJAX : var picture=new FormData( $("#picture")[0] ); var url =

Hide submit button using Javascript

▼魔方 西西 提交于 2021-01-28 03:59:41
问题 How do I hide the submit button using javascript? Reason is because my form checkboxes submits the form on click but only when JS is enabled. For those with JS disabled, I want them to see the submit button, so I want to hide the submit button using JS. I'm using Codeigniter if this helps. Thanks! 回答1: Why javascript when noscript will do the job: <form> . . . <noscript> <input type="submit" /> </noscript> </form> 回答2: simple javascript, <body onload="hideButton()"> <script> function

Receiving the single result with Codeigniter

陌路散爱 提交于 2021-01-28 01:15:45
问题 My model query: public function getWorkDays ($id, $month){ $query = $this->db->query("SELECT count(DISTINCT (day)) FROM hours WHERE userid = ? AND month = ?", array($id, $month)); $row = $query->result(); return $row[0]; } My view: <p>Total Days: <?php echo var_dump($workDays); ?></p> The error: Total Days: object(stdClass)#35 (1) { ["count(DISTINCT (day))"]=> string(1) "9" } 9 should be a correct value but I can't get it with a simple result echo. Also I'm interested why do I have a part of

Does java spring boot provides query builder like php CodeIgniter query builder

做~自己de王妃 提交于 2021-01-27 23:08:56
问题 We are developing an application in spring boot, where we will be creating and publishing dynamic forms into our application at runtime to post the form-data into the db (MySql) in JSON format. We want to create a generic api to handle CRUD operations for all dynamic forms. We know about the php code-igniter framework query builder, which is capable to build and execute the queries. https://www.codeigniter.com/userguide3/database/query_builder.html#inserting-data For example : $query = $this-

Anyone tested Codeigniter 2.2 on php 5.6?

不羁的心 提交于 2021-01-27 21:04:09
问题 just curious to know, has anyone tested CodeIgniter application on PHP 5.6? We are upgrading our server from 5.3.3 to 5.6 currently running CodeIgniter 2.2 . Will that be fine? if yes, I would really appreciate if you post your feedback what performance change you have encountered 回答1: I have a live site using CI 2.1.3 with php 5.6 that has been running smoothly for more than a year (maybe longer). No CI related problems that I can recall. 来源: https://stackoverflow.com/questions/40051122

Can't access fetch post data in controller: Codeigniter

孤街醉人 提交于 2021-01-27 20:28:15
问题 I'm making a post request using fetch in my codeigniter project. The request looks like this fetch('myurl/mycontroller', { method: 'POST', headers: { "Content-Type": "application/json" }, body: JSON.stringify({ testdata: 123, }) }).then((res) => { console.log(res); }).catch(console.log); My controller looks like below class MyController extends CI_Controller { public function mycontroller() { $data = $this->input->post('testdata'); return $data . " is the passed data."; } } But the data isn't

Not redirected to specific URL in Codeigniter 4

一世执手 提交于 2021-01-27 13:50:49
问题 Why is it that whenever I redirect something through the constructor of my Codeigniter 4 controller is not working? <?php namespace App\Controllers\Web\Auth; class Register extends \App\Controllers\BaseController { function __construct() { if(session('username')){ return redirect()->to('/dashboard'); } } public function index() { // return view('welcome_message'); } } But if I put it inside index it's working as expected. public function index() { if(session('username')){ return redirect()-

Codeigniter session destroy after redirect

大憨熊 提交于 2021-01-27 13:49:29
问题 I am adding order id and cart items in session. if I add 2 cart items in session. It's works fine. If I add 3 or more items of cart in session. All the data after redirect lost. the name of controller is checkout. function pay_order($order_id){ $this->load->helper('url'); $this->load->library('session'); $this->load->library('cart'); $this->load->helper('url'); $this->load->helper('form'); $output = $this->cart->contents(); $output = $this->sort_array($output); $list['data'] = $output; $list[