<?php function ss($s1, $s2, $s3, $s4, $s5, $s6) {
$sonucArray = array("alti" => 0, "bes" => 0, "dort" => 0, "uc" => 0, "iki" => 0);
$sayiArray = array($s1, $s2, $s3, $s4, $s5, $s6);
$sayiArraySql = join(',',$sayiArray);
$query = mysql_query("select * from loto where
s1 in ($sayiArraySql) or
s2 in ($sayiArraySql) or
s3 in ($sayiArraySql) or
s4 in ($sayiArraySql) or
s5 in ($sayiArraySql) or
s6 in ($sayiArraySql)");
while ($record = mysql_fetch_array($query)) {
$controlArray = array($record["s1"],$record["s2"],$record["s3"],$record["s4"],$record["s5"],$record["s6"]);
$diffArray = array_diff($sayiArray,$controlArray);
if (count($diffArray) == 0)
$sonucArray["alti"]++;
else if (count($diffArray) == 1)
$sonucArray["bes"]++;
else if (count($diffArray) == 2)
$sonucArray["dort"]++;
else if (count($diffArray) == 3)
$sonucArray["uc"]++;
else if (count($diffArray) == 4)
$sonucArray["iki"]++;
}
return $sonucArray;
}
mysql_fetch_array; 使用过多的 CPU 且速度不快!
“s1-s2-s3-s4-s5-s6”是整数。
相反,什么应该是代码?我知道php不足。有人建议我使用“mysql_fetch_row”,但我无法通过调整来写入它
我应该怎么?