Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. <?php
  2.  
  3. $host = '127.0.0.1'; // Host del database
  4. $db   = 'furniture_test'; // Nome del database
  5. $user = 'root'; // username
  6. $pass = 'root'; // password
  7.  
  8. $dsn = "mysql:host=$host;dbname=$db";
  9. $pdo = new PDO($dsn, $user, $pass);
  10.  
  11. // Prelevo i parametri passati dalla richiesta
  12. $model_id = $_GET['model'];
  13. $texture_id = $_GET['texture'];
  14.  
  15. // Ottengo l'immagine combinata
  16. $statement = $pdo->query("SELECT * FROM images WHERE id_model = $model_id AND id_texture = $texture_id");
  17. $image = $statement->fetch();
  18.  
  19. // Ritorno il percorso dell'immagine
  20. echo json_encode(array(
  21.     'picture' => $image['img_path']
  22. ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement