Я хочу выбрать, а затем var_dump
строки базы данных, но не могу, поскольку var_dump
возвращает bool(false)
.
Моя модель: (Players.php).
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Players extends CI_Model
{
private $table_name = 'players';
function __construct()
{
parent::__construct();
}
function get($id = FALSE)
{
$this->db->select();
$this->db->where('ban <', time());
if ( $id )
$this->db->where('id =', $id);
$query = $this->db->get($this->table_name);
return $query->num_rows() == 0;
}
}
/* End of file test.php */
/* Location: ./application/models/test.php */
Мой контроллер player.php:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Player extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->load->library('tank_auth');
}
public function index()
{
$this->load->model('players');
$this->load->view('template/header');
$this->load->view('default');
var_dump($this->players->get());
$this->load->view('template/footer');
}
}
/* End of file player.php */
/* Location: ./application/controllers/player.php */
У вас есть какие-нибудь решения для этого?