title: JSON: Filter mysql data using a mysql column (PHP)
body: <pre><code>{
    "data": [
      {
        "title": "Section 1",
        "section": [
          {
            "name": "Donut",
            "image": "https://thecustomizewindows.com/wp-content/uploads/2011/11/Nicest-Android-Live-Wallpapers.png"
          }
  
        ]
      },
      {
        "title": "Section 2",
        "section": [
          {
            "name": "Donut",
            "image": "https://thecustomizewindows.com/wp-content/uploads/2011/11/Nicest-Android-Live-Wallpapers.png"
          }
        ]
      },
      {
        "title": "Section 3",
        "section": [
          {
            "name": "Donut",
            "image": "https://thecustomizewindows.com/wp-content/uploads/2011/11/Nicest-Android-Live-Wallpapers.png"
          }
  
        ]
      }
    ]
  }
  </code></pre>
  
  <p>I have PHP wrriten like this:
      function getAllVideo(){</p>
  
  <pre><code>        $stmt = $this-&gt;con-&gt;prepare("SELECT * FROM video");
          $stmt-&gt;execute();
          $stmt-&gt;bind_result($v_id,$video_image,$video_name,$category);
          $video = array();
          $action = array();
          while($stmt-&gt;fetch()){
              $temp = array();
  
              $temp['v_id'] = $v_id;
              $temp['video_image'] = $video_image;
              $temp['video_name'] = $video_name;
              $temp['category'] = $category;
  
              array_push($video, $temp);        
          }        
          return $video;
      }
  </code></pre>
  
  <p>Can you please help how can I design this code? I have category column and want to sort in Json like that. Please assist.
  I am using Slim-3 framework and would need a json formatting.</p>