| Дата: Понедельник, 20.09.2010, 10:06 | Сообщение # 1 |
Группа: Администраторы
Сообщений: 1530
| <html> <head> <style> div {float:left;margin-left:5px;}; </style> </head> <body> <br><br><br> <?php //$x = mt_rand(1,100000); //echo $x;
$host="localhost"; $bd_user="user"; $pass="pass"; $bd_name="bd_name"; $link = mysql_connect($host,$bd_user,$pass); mysql_select_db($bd_name, $link) or die(mysql_error()); $tab="tab";
$query = "SELECT * FROM `".$tab."` ORDER BY `".$tab."`.`3` ASC"; $res = mysql_query($query, $link);
$co2=0; $co3=1; while($row = mysql_fetch_array($res)) { $co2++; $co4=$co2; $co5=$co3; if($co2==5) { $t="</div><br>\n"; $co2=0; $co3++; } else {$t="</div> ";} echo "<div id=".$co5.$co4.">".$row["1"].$t; }
$query = "SELECT * FROM `".$tab."` ORDER BY `".$tab."`.`1` ASC"; $res = mysql_query($query, $link);
$co=9; while($row = mysql_fetch_array($res)) { $co++;
$x = mt_rand(1,100000); mysql_query("UPDATE `".$bd_name."`.`".$tab."` SET `3` = '".$x."' WHERE `".$tab."`.`1` =".$co.";"); //echo "<br>".$row["1"]." ".$row["2"]; }
echo "<br><br><div id='num'></div>";
$query = "SELECT * FROM `".$tab."` ORDER BY `".$tab."`.`3` ASC"; $res = mysql_query($query, $link);
echo "<script> var ar=new Array(";
while($row = mysql_fetch_array($res)) {
echo $row["1"].", "; //echo $row["1"].", "; } echo "'end');
var ix=-1;
var t = window.setInterval('nomera()', 200);
function nomera() { ix++;
document.getElementById('num').innerHTML+=ar[ix]+', '; for(var i2=1;i2<19;i2++) { for(var i3=1;i3<6;i3++) { var x2=''+i2+i3;
if(ix<90) { if(ar[ix]==document.getElementById(x2).innerHTML) {document.getElementById(x2).style.color='red';} } else {clearInterval(t);} } }
} //nomera </script>";
mysql_close ($link); ?>
</body> </html>
Рабочий пример
|
|
| |