我知道这个问题很多,但我只是无法弄清楚如何使用已经回答的帖子来做到这一点.在这里,我在一个页面上有不同的菜单.当我点击每个菜单时,我希望该菜单处于活动状态,但此处不起作用.
这是我的浏览页面:
<ul class="nav navbar-nav navbar-right">
<li class="active"> <a class="page-scroll" href="<?php echo base_url();?>nowaste_control/index#about">About</a> </li>
<li class=""><a class="page-scroll" href="<?php echo site_url('nowaste_control/index#product'); ?>">Products</a> </li>
<li class=""> <a class="page-scroll" href="<?php echo base_url();?>nowaste_control/index#technology">Technology</a> </li>
</ul>
Run Code Online (Sandbox Code Playgroud)
这是我的jQuery:
<script type="text/javascript">
$('.nav navbar-nav li a').click(function($) {
$('a[href="'+window.location.pathname+window.location.hash+'"]').parent().addClass('active');
});
</script>
Run Code Online (Sandbox Code Playgroud) 在这里,我想加入两个表并希望产生像
Akbar Travels building 2018-10
Thrikandiyur Quarters 2018-10
Akbar Travels building 2018-11
Thrikandiyur Quarters 2018-11
Run Code Online (Sandbox Code Playgroud)
这里我有两个表名table A,table B,table A结构看起来像这样
category_id category_name
5 Akbar Travels building
6 Thrikandiyur Quarters
Run Code Online (Sandbox Code Playgroud)
table B 结构看起来像这样
id paying_month parent_category
1 2018-10 5
2 2018-10 5
3 2018-11 5
4 2018-11 5
5 2018-10 6
Run Code Online (Sandbox Code Playgroud)
在这里为了获得输出,我写了这样的代码
public function get_date_wise_pdf_report($from, $to)
{
$query=$this->db->query("SELECT * from tableA A left join tableB B on A.category_id = B.parent_category and B.paying_month BETWEEN '{$from}' AND '{$to}' ");
return …Run Code Online (Sandbox Code Playgroud)