<var id="xvh3p"><noframes id="xvh3p"><var id="xvh3p"></var><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing>
<var id="xvh3p"><strike id="xvh3p"><var id="xvh3p"></var></strike></var><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<span id="xvh3p"><noframes id="xvh3p"><dl id="xvh3p"></dl>
<span id="xvh3p"><noframes id="xvh3p">
<dl id="xvh3p"><noframes id="xvh3p">
<listing id="xvh3p"><noframes id="xvh3p"><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<th id="xvh3p"><strike id="xvh3p"></strike></th>
<dl id="xvh3p"><noframes id="xvh3p">
<th id="xvh3p"><noframes id="xvh3p">

观点

互联网+时代,说建站,谈运营与网络营销

DEDE runphp=yes SQL语名详解

时间:2020-12-15

DedeCms在dede:arclist标签 如何调用附加表内容
在dede:arclist 中调用附加表内容

{dede:arclist   titlelen='26' row='20' orderby='id'}
title=[field:title/]
typeid="[field:typeid/]
[field:id runphp="yes"]
$dsql = new DedeSql(false);
$a="SELECT game.assprice,game.msg,game.bigpic,game.model,game.sptype,gameetime,game.brand
FROM dede_addongame_tg as game where game.aid=@me";
$arcRow = $dsql->GetOne($a);
@me='url="'.$arcRow[sptype].'" leixing="'.$arcRow[model].'" pingfen="'.$arcRow[assprice].'" lurl="'.$arcRow[cometime].'" regurl="'.$arcRow[brand].'"';
[/field:id]

info="[field:description /]
post="[field:id/]"

click="[field:click /]"
href="[field:arcurl/]"
img="<a href='[field:arcurl/]'><img src='[field:litpic/]' border='0' width='110' height='80' alt='></a>"
/>
<A href="[field:arcurl/]"><IMG height=80 alt=
src="[field:litpic/]" width=110 border=0></A>
{/dede:arclist}   

[field:id runphp="yes"]
$dsql = new DedeSql(false);
$a="SELECT game.assprice,game.msg,game.bigpic,game.model,game.sptype,gameetime,game.brand
FROM dede_addongame_tg as game where game.aid=@me";
$arcRow = $dsql->GetOne($a);
@me='url="'.$arcRow[sptype].'" leixing="'.$arcRow[model].'" pingfen="'.$arcRow[assprice].'" lurl="'.$arcRow[cometime].'" regurl="'.$arcRow[brand].'"';
[/field:id]
绿颜色所标地方,即是
通过ID,找到AID=ID所对应的附加表
附加表内容调用$arcRow[列名]


详细解释

以下内容只给不懂 PHP和MYSQL的人观看

[field:id runphp="yes"]
//runphp="yes" 表示 [field:id /] 里要运行 PHP程序
$dsql = new DedeSql(false);
//创建一个对象

$a="SELECT game.assprice,game.msg,game.bigpic,game.model,game.sptype,gameetime,game.brand
FROM dede_addongame_tg as game where game.aid=@me";
// 创建数据库语句,并付值给$a,
// dede_addongame_tg as game 定义表的别名为GAME
// where game.aid=@me";查询条件 game.aid=@me 其中 @ME=ID,即文章ID

$arcRow = $dsql->GetOne($a);
// 运行数据库语句并把结果放到数组$arcRow   中
@me='url="'.$arcRow[sptype].'" leixing="'.$arcRow[model].'" pingfen="'.$arcRow[assprice].'" lurl="'.$arcRow[cometime].'" regurl="'.$arcRow[brand].'"';
//付值给@ME返回,这里,要想输出的值,必须付值给@me ,为了减少读取数据库的次数,这里一次把所有的结果都输出了. 从数组中读取数据为$arcRow[字段名] 字段名即数据库列名

[/field:id]

0
首页
案例
关于
联系