php for size for size _check db prepare SELECT FROM table where and _c

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
for ($x = 0; $x < $size[0]; ++$x) {
for ($y = 0; $y < $size[1]; ++$y) {
$_check = $db -> prepare('SELECT * FROM `table` where `x` = ? and `y` = ?');
$_check -> execute([$x,$y]);
$check = $_check-> fetch();
$_items = $db -> prepare('SELECT * FROM `items` where `id` = ?');
$_items -> execute([$check['item']]);
$item_check = $_items -> fetch();
if($check) for($x2 = $check['x']; $x2 <= $item_check['width']; ++$x2){
$i++;
for ($y2 = $check['y']; $y2 <= $item_check['height']; ++$y2) {
echo '
x'.$i.' - '.$x2.'<br />
y'.$i.' - '.$y2.'<br />
';
}
}
//echo $item_check['width'] * $item_check['height'].' ';
//if($check) echo 'x1 - '.$check['x'].', y1 - '.$check['y'].' <br/ > ';
//if($check) echo 'x1 - '.$check['x'].', y1 - '.$check['y'].' <br/ > ';
imagecopyresampled($basis, $slot, $x * $dp, $y * $dp, 0, 0, $dp, $dp, $slot_width, $slot_height);
}
}