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条)

报告相同问题?

悬赏问题

  • ¥15 想用@vueuse 把项目动态改成深色主题,localStorge里面的vueuse-color-scheme一开始就给我改成了dark,不知道什么原因(相关搜索:背景颜色)
  • ¥20 OPENVPN连接问题
  • ¥15 flask实现搜索框访问数据库
  • ¥15 mrk3399刷完安卓11后投屏调试只能显示一个设备
  • ¥100 如何用js写一个游戏云存档
  • ¥15 ansys fluent计算闪退
  • ¥15 有关wireshark抓包的问题
  • ¥15 需要写计算过程,不要写代码,求解答,数据都在图上
  • ¥15 向数据表用newid方式插入GUID问题
  • ¥15 multisim电路设计