电影中心 精品软件 联系我们

 找回密码
 立即注册

QQ登录

只需一步,快速开始

Close
查看: 1987|回复: 0

关于Lht_CV2.0_0103 团购导航程序的报错修改

[复制链接]
发表于 2011-1-24 03:38:16 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
3 m* b: Q; R! A
byLht_CV2.0_0103; p* S  W+ e" @9 k8 t) f) W
PHPUP info: MySQL Query Error
0 ], }% v  B; R/ b2 u  j% jTime: 2011-1-22 2:18pm
) \# Q) z$ H* f0 c# n4 Z* GScript:
1 T4 B0 u0 a. iSQL: select * from `tuan369`.`tuan369_object` where 1 and type = ‘spike’ and 1295677090 > starttime and 1295677090 < endtime order by localtion limit
6 T3 k5 Y! m7 e, S) q& R$ k; `% yError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ” at line 1' u# V% g- x* K& m, r
Errno.: 1064
# S2 k! C' N: ?) a" o0 o" t+ k
以上错误在没有关闭phperror的时候,你访问首页会在偶然的时间产生(这个时间时候缓存时间限制的)。
/ f* C5 m' B) q- O0 m5 {' _很显然这是一个语法错误mysql的语法在limit后面没有增加限制数量。
- @1 T- ^$ M$ n问题出现的页面时在 inc/common.inc.php 中: U/ t4 u( n; w% h
通过检查这个文件我们可以看到这样的代码
4 ]% G0 S: e6 n( f+ F' Y* C& f. E9 W
if(!checkfile(“object_side”,1800))   //检查缓存文件的时间是不是超过了1800秒
, ~4 A% A- s: x. P{ //如果超过
' E, W3 `6 B" p5 z2 m% Z: g3 m $time = time();
. y  s: x% g( C( T2 D9 p $query=$db->query(“select * from “.tname(‘object’).” where 1 and type = ‘spike’ and $time > starttime and $time < endtime order by localtion limit “.$GLOBALS['setting']['object_sidenum']);   //问题就出在这一句,很显然这里的$GLOBALS['setting']['object_sidenum']没有设置 后台有设置的地方。但是没有设置的时候这里就会出错。我现在没有搞懂如何将变量放进globals里面去的。这里不管他
7 E) t# k( j, Q& I+ p
1 m- ~5 W$ T: F" g5 k while($rows=$db->fetch_array($query))
: O( O1 w1 Y/ F {; ?/ t, X) Q; p! J. x( g% R
  $object_side[]=$rows;  Q  `# y+ t6 D
}
: m1 W' K' e  g. K    + G$ y0 {' A. b
write(‘object_side’,$object_side);//缓存超时的时候写入缓存( n* W) D" v2 M4 D9 P* k
}) j. S4 ]7 G/ ?1 y9 I2 r+ N$ z
else  //没有超时则 读取缓存文件。
0 t% x3 ^  P' z3 n{
1 E: [, i& W& L+ T $object_side=read(“object_side”);
1 L5 U5 p! [/ g. J}
- x, B* _) [1 E# V' K& a+ M8 b
这里很简单我的说明语句也已经指出了问题的所在。
% L% T. o7 Z: h% Q. o关键就在与$GLOBALS['setting']['object_sidenum']这个变量
. E3 m: o: \" ]而在index.php
4 d# X4 W- i* ]8 [/ j
<?php
5 P0 ?+ K; m9 C( u8 Asession_start();
; I8 X& @6 ]$ Z8 Wset_time_limit(1000);6 d' l) }0 V9 o, E2 N; A4 d" `" E
if(!is_file(str_replace(“\\”,’/',dirname(__FILE__)).’/data/config.inc.php’))' y9 W/ ~+ q, P/ B5 H4 X
{1 j, o3 i9 O3 U* T- }* q- A+ p5 X7 o
echo ‘<SCRIPT LANGUAGE=”JavaScript”>& N* B/ Z4 _4 m# l1 q
<!–' v$ Y: a& J4 w
  window.location=”install/index.php”;
% a- @$ L) g$ Y1 R! S& | //–>; ~9 B2 Z$ f% h; a, j
</SCRIPT>’;
3 e2 B$ w( q' A* K# k8 W exit;; \3 k: Z$ \9 G6 a4 V
}1 _3 s- K9 b' \
require(‘inc/common.inc.php’);5 W. {9 T! @; y1 v* t) s
//……………………省略代码
! r" N: \* B1 q5 q  K: ?
在引入common.inc.php文件之前没有看到有关导入globals的信息。所以我不能够确定他正确的被导入了。这里不讨论这个导入问题。
% M4 ?2 B0 s" @, ?在不设置相应变量的时候解决办法是增加 红色代码

2 t/ x! F) T0 Y6 S- x+ Y- @if(!checkfile(“object_side”,1800))% T7 w& G" x$ R: E
{ ( R6 I/ @4 y7 l0 g0 b. T
   if(!$GLOBALS['setting']['object_sidenum'])$GLOBALS['setting']['object_sidenum']=10;5 i# T. h" N, N$ B  }- g% X; `/ b
$time = time();- n0 O' }/ t( L4 v. e( ?& O
$query=$db->query(“select * from “.tname(‘object’).” where 1 and type = ‘spike’ and $time > starttime and $time < endtime order by localtion limit “.$GLOBALS['setting']['object_sidenum']);
4 o7 `" @, N" l4 e8 E: {2 Y   E/ \+ p2 X5 _2 L& d1 y
while($rows=$db->fetch_array($query))1 w7 f6 s8 q4 K+ F" K* I" O& J# _
{
" W2 T' T- W9 Z7 }  $object_side[]=$rows;1 z" I) T8 G) z8 ~0 P4 t2 a* ?
}
! Y( _6 g( `! i2 v( j7 {2 d1 J3 _  W    5 k; U, f% ~! S5 Y* f7 g* R* S& f
write(‘object_side’,$object_side);8 `6 I* X, a: A4 ]. A
}- O; u. {" a, \4 y, k3 x
else& C& g2 p( p( ~! W& L$ \
{$ }& X& i2 l( H: W) G# _2 {
$object_side=read(“object_side”);
2 x% I8 R5 U4 G  Y}

# M/ U% I8 C+ `. f给该变量定义一个值。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|帮助|古城IT技术联盟 ( 鲁ICP备06030014号 )

GMT+8, 2024-4-25 14:55 , Processed in 0.200970 second(s), 10 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表