<?php error_reporting(-1); ini_set('display_errors', 'On'); include '../Classes/VideosActions.php'; include '../Classes/DB.php'; include '../config.php'; $videos = new VideosActions(); $allVideos = $videos->getAllCategories(); $data = array(); while ($row = $allVideos->fetch(PDO::FETCH_ASSOC)) { $data[] = $row; } echo json_encode($data);