Advertisement
Nikita051

Untitled

Sep 11th, 2022
970
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <?php
  2.     $local = "localhost";
  3.     $login = "root";
  4.     $pass = "root";
  5.     $name = "market";
  6.     $link = mysqli_connect($local,$login,$pass,$name);
  7.  
  8.     $catSlug = $params['catSlug'];
  9.     $query = mysqli_query($link,"SELECT * FROM pages
  10.        LEFT JOIN categories  ON categories.id = pages.category_id
  11.        WHERE categories.slug = '$catSlug'
  12.    ") or die(mysqli_error($link));
  13.     $data = [];
  14.     while($row = mysqli_fetch_array($query)){
  15.         $data[] = $row.'</br>';
  16.     }
  17.     $content = "";
  18.     foreach($data as $value){
  19.         $content .= $value['slug'].'</br>';
  20.     }
  21.     $page = [
  22.         'title' => "All page",
  23.         'content' => $content
  24.     ];
  25.     return $page;
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement