php写每周数据问题代码
php 每周数据
自已写了一段PHP,发现只能读取当今天的数据,前几天的没显示出来,高手看看应怎改。
<?php@header("content-Type: text/html; charset=utf-8");require_once 'inc/site_config.php';require_once 'inc/db_connections.php';require_once 'inc/function.php';mysql_query('set character set "utf8"');?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title></head><script type="text/javascript" src="http://www.hkjinku.com/statics/js/jquery.js"></script><!--导航JS--><script type="text/javascript" src="http://www.hkjinku.com/statics/js/function.js"></script><!--导航JS--><script type="text/javascript" src="http://www.hkjinku.com/statics/js/home.js"></script><!--选项卡--><style type="text/css"><!--@font-face { font-family:"微软雅黑"; src:url("微软雅黑.ttf");} *{margin:0px auto;padding:0px; }body { color: #666666; font-size: 12px;}a:link,a:visited,a:hover,a:active{color: #666666;text-decoration: none; font-size:12px;}/*全球经济数据*/#qqjjsj{float:left; overflow:hidden; width:580px; margin-bottom:10px;}#qqjjsj_title{ height:30px; background:url(http://www.hkjinku.com/statics/2013/element.gif) 0 -109px repeat-x; margin:0 6px;}#qqjjsj_title li{ float:left; width:110px; height:30px; line-height: 34px; font-weight:bold; font-size:14px; display:inline; cursor:pointer; text-align:center;}#qqjjsj_title li.active{ background-image:url(http://www.hkjinku.com/statics/2013/element.gif); background-position:-2px -60px; background-repeat:no-repeat; color:#FFF;}#qqjjsj_title li.unactive{ background-image:url(http://www.hkjinku.com/statics/2013/element.gif); background-position:0 -109px; background-repeat:repeat-x; color:#CCC;}#qqjjsj_content{ float:left; width:570px; border:#381610 5px solid; overflow:hidden;}.tab-hd{ height:30px;}.tab-bd{ height:150px; overflow:hidden;}.tab-bd .scrollFlow{ height:300px; overflow:hidden;}.tab-bd .item{ height:150px; display:block; }.tab-dl dl{ width:100%; height:30px; cursor:pointer;}.tab-dl dl.wi-hd dt,.tab-dl dl.wi-hd dd{ background:url(http://www.hkjinku.com/statics/2013/element.gif) 0 -155px repeat-x; color:#381610;}.tab-dl dl.wi-item:hover dt,.tab-dl dl.wi-item:hover dd{ background:#e5bd78; color:#FFF;}.tab-dl dt,.tab-dl dd{ height:24px; line-height:24px; text-align:center; float:left; display:inline;border:1px solid #CCC;box-shadow:1px 1px 1px #c2c2c2; margin:2px; color:#888888; font-weight:700; font-size:14px; overflow:hidden; }.tab-dl dt{ width:258px;}.tab-dl dd.i1{ width:70px;}.tab-dl dd.i2{ width:70px;}.tab-dl dd.i3{ width:60px;}.tab-dl dd.i4{ width:80px;}.qqjjsj_url{ margin:7px 10px;}--></style><body><!--全球经济数据--> <div id="qqjjsj"> <div id="qqjjsj_title"> <ul> <?php $j = 0; for( $i = 0; $i <7; $i++ ){ //循环输出7天日期 if( (date('N',strtotime('-'.$i.' day'))) < 6 ){ //排除星期六天 echo '<li class="'.(( $j == 0 )?"active":"unactive").'" id="qqjjsj'.$j.'" onmouseover="javascript:Show(\''.$j.'\',\'5\',\'qqjjsj\',\'active\',\'unactive\')">'.(date('n月d日',strtotime('-'.$i.' day'))).'</li>'; $j++; } } ?> </ul> </div> <div id="qqjjsj_content"> <?php $j = 0; for( $i = 0; $i <7; $i++ ){ //循环输出7天内数据 if( (date('N',strtotime('-'.$i.' day'))) < 6 ){ //排除星期六天 $cur_time = mktime(0, 0, 0, date("m") , (date("d")-$i), date("Y")); //当天时间戳 $next_time = mktime(0, 0, 0, date("m") , (date("d")+1-$i), date("Y")); //第二天时间戳 $where = "`AccTime` >= '$cur_time' AND `AccTime` < '$next_time'"; echo '<div style="display: '.(( $j == 0 )?"block":"none").';" id="qqjjsj'.$j.'_nr">'; ?> <div class="tab-dl tab-hd"> <dl class="wi-hd"> <dt>事件</dt> <dd class="i1">前值</dd> <dd class="i2">预期值</dd> <dd class="i3">时间</dd> <dd class="i4">日期</dd> </dl> </div> <div class="tab-dl tab-bd scrollBox<?php echo $j?>"> <div class="scrollFlow"> <div id="scroll_a<?php echo $j?>" class="item"> <?php $s_arr=array(); $i=0; $service_rs=mysql_query("select * from info where CateId='8' and $where order by InfoId desc limit 10"); while($service_row=mysql_fetch_assoc($service_rs)) { $s_arr[$i++]=$service_row; } for($i=0;$i<10;$i++) { ?> <dl class="wi-item"> <dt><a href="info_detail.php?InfoId=<?=$s_arr[$i]['InfoId']?>" target="_blank"><?=$s_arr[$i]['Title']?></a></dt> <dd class="i1"><?=$s_arr[$i]['qz']?></dd> <dd class="i2"><?=$s_arr[$i]['yqz']?></dd> <dd class="i3"><?=$s_arr[$i]['time']?></dd> <dd class="i4"><?=$s_arr[$i]['AccTime']?></dd> </dl> <?php } ?> </div> <div id="scroll_b<?php echo $j?>" class="item"></div> </div> <script type="text/javascript">scrolltop("#scroll_a<?php echo $j?>","#scroll_b<?php echo $j?>",".scrollBox<?php echo $j?>");</script> </div> <?php echo '</div>'; $j++; } } ?> <div class="qqjjsj_url"><a href="news.php?CateId=8" target="_blank"><img src="/static/imghw/default1.png" data-src="http://www.hkjinku.com/statics/2013/qqjjsj.jpg" class="lazy" / alt="php写每周数据问题代码" ></a></div> </div> </div></body></html>
回复讨论(解决方案)
第101行 的 for( $i = 0; $i 内嵌第130行的 for($i=0;$i
你觉得合理吗?
原来是那里问题,把130行的改成I1解决了。。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo
