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 31 32 33 34 35 36 37 38
| <?php
$pdo = new PDO('mysql:host=IP;dbname=DB', 'ID', '****');
if (isset($_GET['hmax']) && isset($_GET['hmin']) && isset($_GET['wmax']) && isset($_GET['wmax'])) {
$sql_tri = 'SELECT height, width, name_tof, dos_tof FROM pictures WHERE dos_tof = :dos_tof AND height <= :sqlmaxheight AND height >= :sqlminheight AND width <= :sqlmaxwidth AND width >= :sqlminwidth';
$sth_tri = $pdo->prepare($sql_tri);
$sth_tri->execute(array('dos_tof' => $dos,
'sqlminheight' => $_GET['hmin'],
'sqlmaxheight' => $_GET['hmax'], //on garde en memoire les dimensions selectionnées 'sqlminwidth' => $_GET['wmin'],
'sqlmaxwidth' => $_GET['wmax']
));
$done_tri = $sth_tri->fetchAll();
$t = 0;
foreach ($done_tri as $done_url){
$pic_sel[$t] = $done_url['name_tof']; // la variable du nom de la photos
$t++;
}
if (isset($_GET['pics'])) {
$values = explode(' ', $_GET['pics']);
$lot_1 = $values[1]-1; // $pics = "De 1 à 50", "De 51 à 100" etc
$lot_3 = $values[3]-1;
}
include('info.php'); //les données XML
$items = new SimpleXMLElement($xmlstr);
$r=0;
$sql_tof = 'SELECT name_tof, dos_tof FROM pictures WHERE dos_tof = :dos_tof';
$sth_tof = $pdo->prepare($sql_tof);
$sth_tof->execute(array(':dos_tof' => $dos));
$done_tof = $sth_tof->fetchAll();
foreach ($done_tof as $done_sel) {
if ($r>=$lot_1 && $r<=$lot_3){
$items->addChild('item_show', $pic_sel[$r]); // on insert le tout dns info.php
//echo $items['item_show'][$r]; // un truc du genre pour avoir une variable par photos
}
$r++;
}
echo $items->asXML(); // fonctionne elle me donne le nom de toutes mes photos
print_r($items);
?> |
Partager