getMessage(); } function get_images($pdo, $search='%', $sort='img_date', $sdir='DESC') { $params = array('search' => $search, 'sort' => $sort, 'sdir' => $sdir); $stmt = $pdo->prepare("SELECT * FROM images WHERE img_title LIKE CONCAT('%', :search ,'%') ORDER BY :sort :sdir;"); $stmt->execute($params); $data = $stmt->fetchAll(); $img_list = ''; echo $img_list; }