php

로또번호가 용지별로 나오게

javackr 2025. 2. 11. 14:22



CREATE TABLE `lotto_645` (
`seq` INT(11) NOT NULL AUTO_INCREMENT,
`no` INT(11) NULL DEFAULT 0,
`a` INT(11) NULL DEFAULT 0,
`b` INT(11) NULL DEFAULT 0,
`c` INT(11) NULL DEFAULT 0,
`d` INT(11) NULL DEFAULT 0,
`e` INT(11) NULL DEFAULT 0,
`f` INT(11) NULL DEFAULT 0,
PRIMARY KEY (`seq`)
)
COLLATE='utf8_general_ci'
ENGINE=MyISAM
;



<?
function getBallColor($number) {
    if ($number >= 1 && $number <= 10) {
        return "#FFE400";
    } elseif ($number >= 11 && $number <= 20) {
        return "#6799FF";
    } elseif ($number >= 21 && $number <= 30) {
        return "#FF5E00";
    } elseif ($number >= 31 && $number <= 40) {
        return "#BDBDBD";
    } elseif ($number >= 41 && $number <= 45) {
        return "#1DDB16";
    } else {
        return "";
    }
}
?>
<table>
<tr>
<?
$sql = "SELECT * from lotto_645 order by no desc limit 100";
$res = mysql_query($sql, $connect);

for($u=0; $set = mysql_fetch_array($res); $u++)
{
$no = $set['no'];
$a = $set['a'];
$b = $set['b'];
$c = $set['c'];
$d = $set['d'];
$e = $set['e'];
$f = $set['f'];
?>
<td align='center' width='20px' height='20px'>
<table border="1" cellspacing="1" cellpadding="1" style='border:1px solid black; border-collapse:collapse;'>
<tr><td colspan='7' align='center' width='20px' height='20px'><b><?=$no?></b></td></tr>
<?for($n = 1, $i = 0; $i < 6; $i++){?>
<tr>
<?for($k = 0; $k < 7; $k++){?>
<td bgcolor='<?=getBallColor($n)?>' align='center' width='20px' height='20px'>

<?if ($a==$n || $b==$n || $c==$n || $d==$n || $e==$n || $f==$n){?><table><tr><td bgcolor='#000000' align='center' width='15px' height='15px'><font color='#FFFFFF'><?=$n?></font></td></tr></table><?}else{?><?=$n?><?}?>

<?$n++;?></td>
<?}?>
</tr>
<?}?>
<tr>
<?for($v = 43; $v < 46; $v++){?>
<td bgcolor='<?=getBallColor($v)?>' align='center' width='20px' height='20px'>

<?if ($a==$v || $b==$v || $c==$v || $d==$v || $e==$v || $f==$v){?><table><tr><td bgcolor='#000000' align='center' width='15px' height='15px'><font color='#FFFFFF'><?=$v?></font></td></tr></table><?}else{?><?=$v?><?}?>

</td>
<?}?>
<?for($c = 0; $c < 4; $c++){?>
<td align='center' width='20px' height='20px'>&nbsp;</td>
<?}?>
</tr>
</table>
</td>
<td width='10px'>&nbsp;</td>
<?if( ($u+1)%7==0 ) {?>
</tr><tr><td align='center' width='20px' height='20px'>&nbsp;</td></tr><tr>
<?}?>
</tr>
</table>

 

 

 

'php' 카테고리의 다른 글

php용 달력소스  (0) 2025.02.18
초간편 레이어팝업 오른쪽하단 고정  (1) 2025.02.11