Код: Выделить всё
load->database('demo', TRUE);}function getData(){...}
(and follow are very much signs like China character +_+)
Код: Выделить всё
class User_model extends CI_Model
{
function __construct()
{
parent::__construct();
#Line 6: $CI =& get_instance();
$this->load->database('demo', TRUE);
}
function getData()
{
$query = $this->db->query("select * from user");
if ($query->num_rows() < 0)
show_error('Database is empty!');
else
return $query->result();
}
}
- Я пытался переписать функцию конструкции (используйте $CI и перепишите следующую строку с помощью $CI->load->database('demo', TRUE))
- Я пытался использовать $db в качестве частной переменной, присвойте $this->$db = $this->load->database('demo', TRUE)...
P/s: Моя среда: Windows XP SP3 / сервер WAMP 2.1 / CodeIgniter 2.0.2
Все конфигурации завершены, и система может без проблем запускать приветственное сообщение.
Подробнее здесь: https://stackoverflow.com/questions/685 ... ed-by-a-st
Мобильная версия