一条mysql语句在php里运行没反应,在Front中就能运行成功!
set@height=0;set@ranking=1;set@shunxu=0;updateskyscraper,(selectName,Height,@shunxu:=...
set @height=0;
set @ranking=1;
set @shunxu=0;
update skyscraper,
(select Name, Height,
@shunxu:=@shunxu+1,
if(Height=@height,@ranking,@ranking:=@shunxu) as Ranking,
@height:=Height
from `skyscraper` order by `Height` desc) as t2
set skyscraper.Ranking=t2.ranking
WHERE skyscraper.Name=t2.name and skyscraper.Height=t2.height;
select * from `skyscraper` order by `Ranking` desc;"; 展开
set @ranking=1;
set @shunxu=0;
update skyscraper,
(select Name, Height,
@shunxu:=@shunxu+1,
if(Height=@height,@ranking,@ranking:=@shunxu) as Ranking,
@height:=Height
from `skyscraper` order by `Height` desc) as t2
set skyscraper.Ranking=t2.ranking
WHERE skyscraper.Name=t2.name and skyscraper.Height=t2.height;
select * from `skyscraper` order by `Ranking` desc;"; 展开
1个回答
展开全部
php有个页面相应时间,默认是30秒,如果30秒内执行不完程序,就不执行了,估计是你的SQL执行时间太长
更多追问追答
追问
具体是什么东西啊?
追答
php.ini中的这个配置,最大执行时间,把这个时间设置长一些或者在php中添加如下代码:set_time_limit(0);如果能够执行的话,建议你优化你的SQL语句
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 30
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询