Advertisement
PlotnikovPhilipp

Untitled

Jul 5th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <?php
  2. if(!empty($_POST)) {
  3. try {
  4. $pdo = new PDO('mysql:host=localhost;dbname=RussianStair', 'root', '', [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
  5. $query = "SELECT name, referrence, price FROM storage WHERE material LIKE '%beech%' AND app LIKE '%forSmallRooms%' AND construct LIKE '%screw%' AND tech LIKE '%onRails%' AND class LIKE '%premium%' AND brand LIKE '%Ladder%';";
  6. $statement = $pdo->query($query);
  7. $responce = "";
  8. while($result = $statement->fetch(PDO::FETCH_CLASS)) {
  9. $responce .= <<<METKA
  10. <section role="option">
  11. <figure style="background: url('{$result['referrence']}') center center / cover no-repeat">
  12. <figcaption>{$result['name']}</figcaption>
  13. </figure>
  14. <span>{$result['price']}</span>
  15. </section>
  16. METKA;
  17. }
  18. echo $responce;
  19. } catch(PDOException $e) {
  20. header("HTTP/1.1 500 Internal ServerError");
  21. echo "".$e->getMessage();
  22. }
  23. }
  24. else {
  25. header("HTTP/1.1 400 Bad Request");
  26. echo "Данные не корректны, повторите отправку данных еще раз";
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement