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

php中文网
发布: 2016-10-11 14:23:17
原创
1167人浏览过

这是原来的调用:
$_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这两个字段,,,改怎么写,,,先谢谢诸位大神了

空心菜的米库
空心菜的米库

1,对界面进行了美化2,对文件里边相同代码进行了综合3,增加了点击次数统计,并对3次点击以上的域名增加热门字样4,对本站出售和个人出售进行了划分5,增加钻石状态说明6,增加了完整的后台界面7,增加对资料修改功能8,增加回收站,可以任意删除域名、恢复删除域名和永久删除数据9,还有其他的细节大家自己看~10.增加域名证书显示11.域名到期时间采用日历控件形式12.后台登陆添加了验证码功能13.还有很多

空心菜的米库 0
查看详情 空心菜的米库

//下面是源码:

!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驱动, 没人回答得了你, 还请重新命好题再提问吧

相关标签:
php
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号