一个异常奇怪的问题:一刷新就异常,重新上传一下模板正常了,再刷新又异常。

vipstar 2010-08-02 07:48:13
php code


$ms =& ms();
$this->assign('set_avatar', $ms->user->set_avatar($id));
$this->assign('user', $user);
$this->assign('phone_tel', explode('-', $user['phone_tel']));
/* 导入jQuery的表单验证插件 */
$this->import_resource(array(
'script' => 'jquery.plugins/jquery.validate.js'
));

$page = $this->_get_page();

//tixian code
$con = mysql_connect("localhost","a0527232048","abc");
mysql_select_db("a0527232048",$con);
$sql="select * from ecm_configs where id=1";
$rows=array();
$rows=mysql_query($sql,$con);
while($row=mysql_fetch_array($rows))
{
$ct1=$row[10];//兑换条件最低积分
$ct2=$row[11]; //兑换时间
$ct3=$row[12]/100; //兑换比率
}

if ($jf1==0 and $jf2==0 and $jf3==0)
{
$sql2="SELECT m.user_name, IFNULL(sum(c.cons), 0) AS cons
FROM ecm_member AS m LEFT JOIN caifujifen AS c ON c.to2=m.user_id
WHERE 1 GROUP BY m.user_name
ORDER BY cons desc";
}
if ($jf1==0 and $jf2==0 and $jf3==1)
{
$sql2="select * from (SELECT m.user_name, IFNULL(sum(c.cons), 0) AS cons
FROM ecm_member AS m LEFT JOIN caifujifen AS c ON c.to2=m.user_id
WHERE 1 GROUP BY m.user_name
ORDER BY cons desc) as t where cons>=".$ct1."";
}
if ($jf1!==0 and $jf2!==0 and $jf3==2)
{
$sql2="select * from (SELECT m.user_name, IFNULL(sum(c.cons), 0) AS cons
FROM ecm_member AS m LEFT JOIN caifujifen AS c ON c.to2=m.user_id
WHERE 1 GROUP BY m.user_name
ORDER BY cons desc) as t where cons>=".$jf1." and cons<=".$jf2."";
}

$rows2=mysql_query($sql2,$con);
$lists=array();
$page['item_count'] = mysql_num_rows($rows2);
while($row2=mysql_fetch_row($rows2))
{
$username=$row2[0];
$jifen=$row2[1];
$mon=$jifen*$ct3;
$lists[]="<tr><td width=50></td>".$username."</td><td width=100>".$jifen."</td><td width=100>".$mon."</td><td width=250><td><td width=100><a href=#>a</a></td>";
}
//tixian code end
$this->_format_page($page);
$this->assign('page_info', $page);
//$this->assign('cftj',zdcfjf($id));
$this->assign('txlist',$sql2);
$this->display('user.tixian.html');


user.tixian.html 代码


<table class="tab1">
<tr><td width="50" align="center"><strong>ID</strong></td><td width="100" align="center"><strong>用户</strong></td><td width="100" align="center"><strong>财富积分</strong></td><td width="350" align="center"><strong>可提现金额</strong></td><td width="100" align="center"><strong>操作</strong></td></tr>
{foreach from=$txlist item=txlist }
{$txlist}
{/foreach}
</table>



程序做好后,第一次浏览页面,是正常的,能调出符合条件的N条记录;
可刷新一次,就异常了,只能调了一条记录,异常的时候打印$sql2也是正常的,把异常时候的$sql2语句放到phpmyadmin执行的结果是正常的;

这个时候 ,再上传一次 user.tixian.html 刷新一次的时候是正常的,再刷新一次,又出现上面的异常;

再上传 user.tixian.html 又正常,再刷新,又异常。。。

这中间我也注意观察了服务器上的user.tixian.html 没有自己更改过,也不可能自己更改吧这模板文件?


折磨了一晚上了,请帮忙看看,谢谢。
...全文
85 点赞 收藏 9
写回复
9 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
vipstar 2010-08-02
果真如此,谢谢 dingsongtao !
回复
Dleno 2010-08-02
{foreach from=$txlist item=txlist }

form和item的名字不要一样。

{foreach from=$txlist item=txl }
{$txl}
{/foreach}
回复
vipstar 2010-08-02
再次谢谢 amani11

我把以上代码,做为一个单独的php文件运行,不与smarty结合,是完全正常的。。。

我再多试试,再次感谢,帮我很多。
回复
amani11 2010-08-02
没研究过ecmall

不过我给你个笨办法

print_r($lists);exit;

如果结果还是第一次正常,第二次一条数据

往上,print_r($sql2);exit;重复步骤,打印看看语句,是否第二次执行不一样了

反之,往下走……分析关键点的变量

祝你好运
回复
vipstar 2010-08-02
这是完整的积分提现代码,


function tixian()
{

$ms =& ms();
$this->assign('set_avatar', $ms->user->set_avatar($id));
$this->assign('user', $user);
$this->assign('phone_tel', explode('-', $user['phone_tel']));
/* 导入jQuery的表单验证插件 */
$this->import_resource(array(
'script' => 'jquery.plugins/jquery.validate.js'
));

$page = $this->_get_page();

//tixian code
$con = mysql_connect("localhost","a0527232048","21740200");
mysql_select_db("a0527232048",$con);
$sql="select * from ecm_configs where id=1";
$rows=array();
$rows=mysql_query($sql,$con);
while($row=mysql_fetch_array($rows))
{
$ct1=$row[10];//兑换条件最低积分
$ct2=$row[11]; //兑换时间
$ct3=$row[12]/100; //兑换比率
}

if ($jf1==0 and $jf2==0 and $jf3==0)
{
$sql2="SELECT m.user_name, IFNULL(sum(c.cons), 0) AS cons
FROM ecm_member AS m LEFT JOIN caifujifen AS c ON c.to2=m.user_id
WHERE 1 GROUP BY m.user_name
ORDER BY cons desc";
}
if ($jf1==0 and $jf2==0 and $jf3==1)
{
$sql2="select * from (SELECT m.user_name, IFNULL(sum(c.cons), 0) AS cons
FROM ecm_member AS m LEFT JOIN caifujifen AS c ON c.to2=m.user_id
WHERE 1 GROUP BY m.user_name
ORDER BY cons desc) as t where cons>=".$ct1."";
}
if ($jf1!==0 and $jf2!==0 and $jf3==2)
{
$sql2="select * from (SELECT m.user_name, IFNULL(sum(c.cons), 0) AS cons
FROM ecm_member AS m LEFT JOIN caifujifen AS c ON c.to2=m.user_id
WHERE 1 GROUP BY m.user_name
ORDER BY cons desc) as t where cons>=".$jf1." and cons<=".$jf2."";
}

$rows2=mysql_query($sql2,$con);
$lists=array();
$page['item_count'] = mysql_num_rows($rows2);
while($row2=mysql_fetch_row($rows2))
{
$username=$row2[0];
$jifen=$row2[1];
$mon=$jifen*$ct3;
$lists[]="<tr><td width=50></td>".$username."</td><td width=100>".$jifen."</td><td width=100>".$mon."</td><td width=250><td><td width=100><a href=#>a</a></td>";
}
//tixian code end
$this->_format_page($page);
$this->assign('page_info', $page);
//$this->assign('cftj',zdcfjf($id));
$this->assign('txlist',$lists);
$this->display('user.tixian.html');

}
//积分提现结束
回复
vipstar 2010-08-02
[Quote=引用 1 楼 amani11 的回复:]
LZ很勤劳啊,向你学习


代码没给全吧?最后的打印列表,是保存在数组$lists??
[/Quote]

谢谢您的回复,
代码只是给了相关的部份,这是在修改ECMALL,其他未给出的是ECMALL自带的代码,
打印的列表是保存在$lists里面,模板用的是smarty,

我奇怪的是为什么总是第一次浏览的时候正常,再刷新就异常了。。。上传一下模板,未做任何改动的模板,再浏览就正常了,再刷新就异常。。如此反复。。

谢谢 2楼的办法 我这就试试
回复
xuzuning 2010-08-02
清空 c_template 文件夹
回复
amani11 2010-08-02
LZ很勤劳啊,向你学习


代码没给全吧?最后的打印列表,是保存在数组$lists??
回复
yushyu114 2010-08-02
我看是LZ的服务器写权限有问题吧。。
回复
发动态
发帖子
基础编程
创建于2007-09-28

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
社区公告
暂无公告