Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!empty($_POST)) {
- try {
- $pdo = new PDO('mysql:host=localhost;dbname=RussianStair', 'root', '', [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
- $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%';";
- $statement = $pdo->query($query);
- $responce = "";
- while($result = $statement->fetch(PDO::FETCH_CLASS)) {
- $responce .= <<<METKA
- <section role="option">
- <figure style="background: url('{$result['referrence']}') center center / cover no-repeat">
- <figcaption>{$result['name']}</figcaption>
- </figure>
- <span>{$result['price']}</span>
- </section>
- METKA;
- }
- echo $responce;
- } catch(PDOException $e) {
- header("HTTP/1.1 500 Internal ServerError");
- echo "".$e->getMessage();
- }
- }
- else {
- header("HTTP/1.1 400 Bad Request");
- echo "Данные не корректны, повторите отправку данных еще раз";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement