codeigniter-2

Code Igniter 2.1 autocomplete/IntelliSense in Eclipse

时间秒杀一切 提交于 2019-12-03 06:52:49
I am using Eclipse PDT to code with PHP Code Igniter. I would like to get auto complete working. Anyone know how I can accomplish this? I've found a few online tutorials but had no success. You could try this method Choose “Project” -> “Properties” or “Window” -> “Preferences” -> “PHP” (for global usage) Choose “PHP Include Path” Click on “Add External Source Folder” and point to file below restart eclipse Point path to this file below ciautocomplete.php <?php /** * @property CI_DB_active_record $db * @property CI_DB_forge $dbforge * @property CI_Benchmark $benchmark * @property CI_Calendar

How to route 2 parameters to a controller?

早过忘川 提交于 2019-12-03 05:38:05
This seems really basic but i can't get the hang of it. I'm trying to send more then one parameter to a method in the controller, like this : http://localhost/ci/index.php/subjects/3/state This is the routings i've tried : $route['subjects/(:num)'] = 'subjects/view/$1'; $route['subjects/(:num)/{:any}'] = 'subjects/view/$1/$2'; the method accepted 2 paremeters : public function view($slug, $id = null){ } but i seem to get a 404. How can i get this to work? i need the view method to always accept 1 parameter and optional other parameters. NOTE : I am including the url helper. you have problem

how to pass a variable from one controller to the other in Code igniter

僤鯓⒐⒋嵵緔 提交于 2019-12-03 02:46:38
I have just started learning Code Igniter . I want to know how can I pass a variable from one controller(first_cont.php) to other controller (second_cont.php) ? Any help would be appreciated . Thanks in Advance :) It will depend on the circumstances. If you want to retain the data for some time, then session data would be the way to go. However, if you only need to use it once, flash data might be more appropriate. First step would be to initialise the session library: $this->load->library('session'); Then store the information in flash data: $this->session->set_flashdata('item', $myVar);

Undefined $load property error after upgrading CodeIgniter 1.7 to 2.1

自古美人都是妖i 提交于 2019-12-02 19:17:05
问题 Why I get this error after upgrading CodeIgniter from v1.7 to v2.1? A PHP Error was encountered Severity: Notice Message: Undefined property: Site::$load Filename: libraries/Website.php Line Number: 25 Fatal error: Call to a member function library() on a non-object in C:\xampp\htdocs\travel\application\libraries\Website.php on line 25 The library application/library/website class Website extends CI_Controller { public static $current_city; public function __construct() { $this->load->library

codeigniter: editing and deleting from database

和自甴很熟 提交于 2019-12-02 19:09:50
问题 I am having trouble coding to edit/delete a question in the database. From my quiz questions. This is my model. I would like to edit a question from the view through the controller. This is my current mode: function getquestions($quizid) { // get data about the quiz - we need the quiz size $quiz = $this->getquiz($quizid); $qzsize = $quiz['quizsize']; $this->db->select('id'); // we want just the id fields $this->db->limit($qzsize); // how many questions to ask // this next clause allows us to

Not to load an autoload library in codeigniter

心不动则不痛 提交于 2019-12-02 18:28:32
问题 I have a library which is used by all controllers. But for a specific controller i dont want to load that library. Is there any way i can stop loading that library for that controller. i am using this command but its failing: $this->load->library('xyz',array('autoload' => FALSE)); Thanks 回答1: Autoloading is meant for site-global items. A cleaner solution may be to extend the controller and load the library in that new controller's constructor. Then all of your controllers extend from that

Call to undefined method CI_DB_mysql_driver::num_rows()

别等时光非礼了梦想. 提交于 2019-12-02 17:14:50
问题 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Welcome_model extends CI_Model { public function select(){ $this->db->get('av_home'); echo $this->db->num_rows(); } } Above code gives error, Call to undefined method CI_DB_mysql_driver::num_rows() 回答1: The number of rows returned by the query.With num_rows() you first perform the query, and then you can check how many rows you got. $query is the variable that the query result object is assigned to: $query=$this-

codeigniter: editing and deleting from database

时间秒杀一切 提交于 2019-12-02 13:08:27
I am having trouble coding to edit/delete a question in the database. From my quiz questions. This is my model. I would like to edit a question from the view through the controller. This is my current mode: function getquestions($quizid) { // get data about the quiz - we need the quiz size $quiz = $this->getquiz($quizid); $qzsize = $quiz['quizsize']; $this->db->select('id'); // we want just the id fields $this->db->limit($qzsize); // how many questions to ask // this next clause allows us to select random questions - a full discussion of how this works and its drawbacks is // here https://www

Codeigniter flashdata not working in internet explorer and google chrome

不问归期 提交于 2019-12-02 11:39:36
问题 Codeigniter flashdata not working in internet explorer and chrome but it is working on firefox.What could be the issue?. In My controller:- $this->session->set_flashdata('login_error','Your username or password is incorrect.'); redirect(base_url().'admin/login'); In My view echo '<span>'.$this->session->flashdata('login_error').'</span>'; In Chrome and ie i'm getting blank span whereas in firefox it is displaying flash data. There are similar questions on the stack but i could not find any

Codeigniter send mail using gmail is not working, just reloading

大憨熊 提交于 2019-12-02 11:32:33
问题 I tried to send a email using gmail server with following configurations. $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_user' => 'dinukathilanga@gmail.com', 'smtp_pass' => '2334444@', 'mailtype' => 'html', 'charset' => 'iso-8859-1', 'starttls' => true, ); $this->load->library('email', $config); $this->email->from('dinukathilanga@gmail.com', 'Dinuka Thilanga'); $this->email->to('bbelekkaya@gmail.com'); $this->email->subject('Email