dtgr3392 2017-03-30 10:52
浏览 39
已采纳

尝试修改codeigniter应用程序db表中的字段,但知道如何识别表

I am beginner in code igniter php framework. Today I have a task to modify existing code and somehow I am lost in the middle of the line on attempting to located a database table. This is the controller snippet that renders the view

..........
$data["all_types"] = $this->data_model->get_data("all_types",300,"Asc");
$this->load->view("preview_brands",$data);
...........

when the view is loaded I am iterating through the in the view to load data as shown

 <div class="decoration"></div>
 <?php foreach($all_types as $item): ?>
 <div style="display:block;color:#000;">
    <a style="font-size:17px;margin:15px 2px;font-family:Cgothic;"
                           href="<?php echo site_url()."...../..../".$item["id"]; ?>"
                           class="scale-hover"
                           title="<?php echo str_replace("_"," ",$item["name"]);?>">
    <strong><?php echo str_replace("_"," ",$item["name"]);?></strong>
    </a>

 </div>             
 <?php endforeach; ?>

this is the model snippet code as shown

function get_data($db,$i,$order)
{
   $this->db->order_by("name",$order);
   $this->db->where('consent',"yes");
   $query=$this->db->get($db);
   return $query->result_array();
}

My challenge is how can I locate or identify the database table the above model is pointing to to fetch data. Hoping someone assists me

  • 写回答

2条回答 默认 最新

  • douou8954 2017-03-30 11:14
    关注

    all_types is your table name.

    $this->db->get($your_table name), get method take table name as a parameter.

    Get Method Documentation

    If more help needed I'm happy to help.

    Happy Coding.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services