codeigniter

My core class My_head not found in codeigniter

[亡魂溺海] 提交于 2019-12-24 04:14:12
问题 i am trying to create core class in codeigniter.in application/core in create a file with the name of MY_head.php and the code of MY_head.php is class MY_head extends CI_Controller{ public function __construct(){ parent::__construct(); } public function load_header(){ //some code here } } Now i am trying to extend this class in my controller practice.php the code is class Practice extends MY_head{ public function __construct(){ parent::__construct(); } function index(){ } } but when i load

A PHP Error was encountered Severity: Notice Message: Undefined property: Site::$site_model

旧巷老猫 提交于 2019-12-24 04:12:20
问题 A PHP Error was encountered Severity: Notice Message: Undefined property: Site::$site_model Filename: controllers/site.php Line Number: 13 Site Controller site.php Fatal error: Call to a member function delete_row() on a non-object in C:\xampp\htdocs\login\application\controllers\site.php on line 13 My controller ->Site.php <?php class Site extends CI_Controller{ function __construct(){ parent::__construct(); $this->is_logged_in(); } function delete(){ $this->site_model->delete_row(); $this-

A PHP Error was encountered Severity: Notice Message: Undefined property: Site::$site_model

爷,独闯天下 提交于 2019-12-24 04:12:10
问题 A PHP Error was encountered Severity: Notice Message: Undefined property: Site::$site_model Filename: controllers/site.php Line Number: 13 Site Controller site.php Fatal error: Call to a member function delete_row() on a non-object in C:\xampp\htdocs\login\application\controllers\site.php on line 13 My controller ->Site.php <?php class Site extends CI_Controller{ function __construct(){ parent::__construct(); $this->is_logged_in(); } function delete(){ $this->site_model->delete_row(); $this-

Codeigniter doesn't let me update entry, because some fields must be unique

跟風遠走 提交于 2019-12-24 04:03:12
问题 So what I'm trying to do: Pull User data from database, including email address, username etc. Edit it Save it But I want to keep username and email unique. And for this I'm setting validation rules like this: $this->form_validation->set_rules('firstname', 'First Name', 'required|min_length[2]|max_length[15]'); $this->form_validation->set_rules('lastname', 'Last Name', 'required|min_length[2]|max_length[15]'); $this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique

Codeigniter - passing multiple values to view

流过昼夜 提交于 2019-12-24 04:01:30
问题 Okay, so generally I wouldn't have a problem doing this and it would be fairly straight forward, but not so much this time. Here is the relevant code in my controller: // In order to properly build the form url, we need to include the // category and product to the view $this->data = array( 'category' => $category, 'product' => $product ); // Load the product model and get editable values from the database $this->load->model('productadmin/products_model'); $productInformation = $this-

Converting date from database to a different timezone

泪湿孤枕 提交于 2019-12-24 03:51:13
问题 I have a website that allows people to post things. When they post, it gets inserted into the database and the database adds a timestamp. When I hosted the database on my local machine, the timestamps were in my time zone. My new hosting website has it set to GMT time. How can I make it display the time in my time zone? I've tried adding date_default_timezone_set('America/New_York'); to my views just under the tag, but that doesn't help. Any ideas? 回答1: // Set the time zone $dateTimeZone =

How to upload file on another domain?

前提是你 提交于 2019-12-24 03:36:13
问题 I have an external hosting server. On that server I have 2 domains: www.dom1.com www.dom2.com On www.dom1.com I have my whole web page (in Codeigniter). One of the functionalities is upload (users can upload their files.) On www.dom2.com there is only one folder called upload_dom2. www.dom2.com is otherwise empty and not visible anywhere on the Internet. I would like to use it exclusively for upload. I imagine that this is a much safer way than letting the users upload their files on www.dom1

Laravel Eloquent integration in Codeigniter

无人久伴 提交于 2019-12-24 03:35:24
问题 I am trying to use eloquent orm inside codeigniter. Following is my composer.json file "require": { "php": ">=5.5.0", "illuminate/database": "5.0" }, "autoload": { "classmap": [ "application/models" ] } In index.php file I have I added require 'vendor/autoload.php'; I have create Eloquent.php file in application/models to initiate eloquent <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $CI = & get_instance(); $config = $CI->db; $pdo = new PDO('mysql:host='.$config-

Codeigniter joined tables getting wrong output

岁酱吖の 提交于 2019-12-24 03:30:03
问题 I'm having an function which gets data from my database, and joins different tables. This is the method: public function getCallcenterCall() { $this->db->select('bedrijf.*, status.status_naam, quickscan.datum_verzonden'); $this->db->join('quickscan', 'bedrijf.id = quickscan.bedrijf_id'); $this->db->join('status', 'bedrijf.status = status.status_id'); $this->db->where('status', '0'); $query = $this->db->get('bedrijf'); return $query->num_rows() > 0 ? $query-> result_array() : FALSE; } In the

access the CI session in a pre controller codeigniter hook

空扰寡人 提交于 2019-12-24 03:27:55
问题 I am using a pre controller hook to detect and set the site language from the session/cookie/browser lang detection.. something like this answer: Codeigniter language I am also using the famous Tank Auth library to manage users and I am using the codeigniter Session class to store and manage the users sessions upon log in. Each user can specify the interface language he wants and store it in the database for future log ins. The lang info is copied from the DB to the session on every log in.