您好,欢迎访问一九零五行业门户网

看看这个如何同时调用两个数据表里的不同数据?

这是原来的调用:
$_g['db']->from('dbpre_subject');
$_g['db']->select('*');
$_g['db']->where('city_id', array(0,$_city['aid']));
$_g['db']->where_concat_like('name,subname', %{$q}%);
$_g['db']->where('status', 1);
现在我要在此基础之上,在调用dbpre_subject_product_new 这个数据表里的c_product_price和c_product_content这两个字段,,,改怎么写,,,先谢谢诸位大神了
//下面是源码:
!defined('in_mudder') && exit('access denied');
$city_id = _get('city_id', null, mf_int_key);
if($city_id>0) {
$citys = $_g['loader']->variable('area');
if(!$city = $citys[$city_id]) redirect('global_area_city_id_invalid');if(!$city['enabled']) redirect('global_area_city_disabled');init_city($city_id);

}
$q = _input('keyword', '', mf_text);
if(($_get['pathinfo'] || $_get['rewrite']) && $q && $_g['charset'] != 'utf-8' && $_g'cfg') {
$q = charset_convert($q,'utf-8',$_g['charset']);
}
$q = str_replace(array(rn,r,n) ,'', _t($q));
$_g['db']->from('dbpre_subject');
$_g['db']->select('*');
$_g['db']->where('city_id', array(0,$_city['aid']));
$_g['db']->where_concat_like('name,subname', %{$q}%);
$_g['db']->where('status', 1);
$multipage = '';
if($total = $_g['db']->count()) {
$_g['db']->sql_roll_back('from,select,where');
$orderby = array($post['ordersort']=>$post['ordertype']);
$offset = 10;
$start = get_start($_get['page'], $offset);
$_g['db']->order_by($orderby);
$_g['db']->limit($start, $offset);
$list = $_g['db']->get();
if($total) {
$multipage = mobile_page($total, $offset, $_get['page'], url(item/mobile/do/search/keyword/$q/page/_page_));
}
}
//显示模版
if($_g['in_ajax']) {
include mobile_template('item_list_li');
output();
}
$title = '搜索产品:'.$q;
include mobile_template('item_list');
回复内容: 这是原来的调用:
$_g['db']->from('dbpre_subject');
$_g['db']->select('*');
$_g['db']->where('city_id', array(0,$_city['aid']));
$_g['db']->where_concat_like('name,subname', %{$q}%);
$_g['db']->where('status', 1);
现在我要在此基础之上,在调用dbpre_subject_product_new 这个数据表里的c_product_price和c_product_content这两个字段,,,改怎么写,,,先谢谢诸位大神了
//下面是源码:
!defined('in_mudder') && exit('access denied');
$city_id = _get('city_id', null, mf_int_key);
if($city_id>0) {
$citys = $_g['loader']->variable('area');
if(!$city = $citys[$city_id]) redirect('global_area_city_id_invalid');if(!$city['enabled']) redirect('global_area_city_disabled');init_city($city_id);

}
$q = _input('keyword', '', mf_text);
if(($_get['pathinfo'] || $_get['rewrite']) && $q && $_g['charset'] != 'utf-8' && $_g'cfg') {
$q = charset_convert($q,'utf-8',$_g['charset']);
}
$q = str_replace(array(rn,r,n) ,'', _t($q));
$_g['db']->from('dbpre_subject');
$_g['db']->select('*');
$_g['db']->where('city_id', array(0,$_city['aid']));
$_g['db']->where_concat_like('name,subname', %{$q}%);
$_g['db']->where('status', 1);
$multipage = '';
if($total = $_g['db']->count()) {
$_g['db']->sql_roll_back('from,select,where');
$orderby = array($post['ordersort']=>$post['ordertype']);
$offset = 10;
$start = get_start($_get['page'], $offset);
$_g['db']->order_by($orderby);
$_g['db']->limit($start, $offset);
$list = $_g['db']->get();
if($total) {
$multipage = mobile_page($total, $offset, $_get['page'], url(item/mobile/do/search/keyword/$q/page/_page_));
}
}
//显示模版
if($_g['in_ajax']) {
include mobile_template('item_list_li');
output();
}
$title = '搜索产品:'.$q;
include mobile_template('item_list');
不知所谓, 你连你们用的什么php框架都不知道, 也不知道用的什么mysql驱动, 没人回答得了你, 还请重新命好题再提问吧
其它类似信息

推荐信息