while($row = mysql_fetch_array($query)){
if($row[c_ones]== $ones || $row[c_ones] == $ones-1 || $row[c_ones]==$ones+1){
$o_qishu[] = $o_qi.' ';
$o_qi = 0; }else{
$o_qi++;
} if($row[c_tens]== $tens || $row[c_tens] == $tens-1 || $row[c_tens]==$tens+1){
$t_qishu[] = $t_qi.' ';
$t_qi = 0; }else{
$t_qi++;
} if($row[c_hundreds]== $hundreds || $row[c_hundreds] == $hundreds-1 || $row[c_hundreds]==$hundreds+1){
$h_qishu[] = $h_qi.' ';
$h_qi = 0; }else{
$h_qi++;
} if($row[c_thousands]== $thousands || $row[c_thousands] == $thousands-1 || $row[c_thousands]==$thousands+1){
$th_qishu[] = $th_qi.' ';
$th_qi = 0; }else{
$th_qi++;
} if($row[c_ten_thousands]== $ten_thousands || $row[c_ten_thousands] == $ten_thousands-1 || $row[c_ten_thousands]==$ten_thousands+1){
$tt_qishu[] = $tt_qi.' ';
$tt_qi = 0; }else{
$tt_qi++;
}
} echo "<br>".max($o_qishu);
echo "<br>".max($t_qishu);
echo "<br>".max($h_qishu);
echo "<br>".max($th_qishu);
echo "<br>".max($tt_qishu);
}
输出数组时,都有很多比9大的数。可是不管怎么样max()都只返回9
if($row[c_ones]== $ones || $row[c_ones] == $ones-1 || $row[c_ones]==$ones+1){
$o_qishu[] = $o_qi.' ';
$o_qi = 0; }else{
$o_qi++;
} if($row[c_tens]== $tens || $row[c_tens] == $tens-1 || $row[c_tens]==$tens+1){
$t_qishu[] = $t_qi.' ';
$t_qi = 0; }else{
$t_qi++;
} if($row[c_hundreds]== $hundreds || $row[c_hundreds] == $hundreds-1 || $row[c_hundreds]==$hundreds+1){
$h_qishu[] = $h_qi.' ';
$h_qi = 0; }else{
$h_qi++;
} if($row[c_thousands]== $thousands || $row[c_thousands] == $thousands-1 || $row[c_thousands]==$thousands+1){
$th_qishu[] = $th_qi.' ';
$th_qi = 0; }else{
$th_qi++;
} if($row[c_ten_thousands]== $ten_thousands || $row[c_ten_thousands] == $ten_thousands-1 || $row[c_ten_thousands]==$ten_thousands+1){
$tt_qishu[] = $tt_qi.' ';
$tt_qi = 0; }else{
$tt_qi++;
}
} echo "<br>".max($o_qishu);
echo "<br>".max($t_qishu);
echo "<br>".max($h_qishu);
echo "<br>".max($th_qishu);
echo "<br>".max($tt_qishu);
}
输出数组时,都有很多比9大的数。可是不管怎么样max()都只返回9
解决方案 »
- 谁能帮我看下新东方在线的网站是不是用PHP弄的?
- mysql.cls.php[52] ErrID:2, mysql_query() [function.mysql-query]: Unable to save
- 从数据库中读取数据后生成的FALSH播放完毕后怎么自动抓取最终图片
- 谁帮我把这个JS翻译成PHP
- 如何显示返回JSON中的某一个数据
- 在线等,帮忙看看为什么数据读不出来
- echo 问题
- php中有几种方法可以支持gif可写
- 【安装】LAMP MySQL不知到安装到哪里去了。yum install mysql-server
- 关于swoole的定时器问题
- PHP写入不了VARCHAR汉字
- 求在载入flash时先显示广告的编码
if($row[c_ones]== $ones || $row[c_ones] == $ones-1 || $row[c_ones]==$ones+1){
$o_qishu[] = $o_qi.' '; // 请问此处的$o_qi的初始值是多少?从你的代码中看不出来。
$o_qi = 0; //符合条件的时候 $o_qi被重置为0;
}else{
$o_qi++; //不符合条件的时候$o_qi加1。
}
// 加下面这句打印出$o_qishu数组看看
print_r($o_qishu);
$query = mysql_query("SELECT * FROM `data_c` order by `id` DESC");
//这些事初始值
$o_qi = 0;
$t_qi = 0;
$h_qi = 0;
$th_qi = 0;
$tt_qi = 0;
$o_qishu = array();
$t_qishu = array();
$h_qishu = array();
$th_qishu = array();
$tt_qishu = array();print_r($o_qishu);//输出的结果符合要求//输出结果,数据太多在这里就只能发一小部分Array ( [0] => 1 [1] => 0 [2] => 0 [3] => 0 [4] => 11 [5] => 6 [6] => 10 [7] => 0 [8] => 2 [9] => 9 [10] => 0.............[5941] => 4 )