doushan2311 2014-10-09 15:26
浏览 34
已采纳

CodeIgniter:查询未被执行

I'm having a strange issue with codeigniter + postgresql. This is my table:

sLearning=> select * from lezione;
 id |      titolo      | descrizione |    data    | corsoid 
----+------------------+-------------+------------+---------
  1 | prova            |             | 2014-10-09 |    1234
  2 | Lezione di oggi! |             | 2014-10-09 |    1234
(2 rows)

I' have manually inserted these two records to test my queries. Btw, this is inside my model Lezione_m:(I removed some checks and other controls but anyway, even this version is not working:)

public function get_lezione()
{
    echo $this->db->_error_message();
    $query = $this->db->get('lezione');
    return $query->result();
}

This is my controller:

class Test_c extends CI_Controller
{

function __construct() 
{
    parent::__construct();
    $this->load->model('Lezione_m');
}
public function index()
{     

    $this->load->view('test', $data);
    $this->output->enable_profiler(TRUE);
    echo '<pre>';  
        print_r($this->Lezione_m->get_lezione(null, 1234)); 
    echo '</pre>';
}

The print_r:

Array
(
)

What the profiler says about my query:

0.0001      SELECT *
FROM "lezione" 

Not sure what is going on here. I'm pretty sure that codeigniter it's connected to the database ( i would get some kind of error in that case).

  • 写回答

1条回答 默认 最新

  • duanjie3267 2014-10-09 18:17
    关注

    Done. It's a strange thing, but site were working but the port number inside the database config file were wrong.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c