getMessage();
}
function get_images($pdo, $search='%', $sort='img_date', $sdir='DESC') {
if ($sort != 'img_date' && $sdir != 'ASC') {
if ($sort != 'img_title' && $sdir != 'DESC') {
echo('Ey boss, database request is kinda f*cked up. Maybe you want to try that again, hey...
'.$sort.' '.$sdir);
die();
}
}
$params = array('search' => $search);
$stmt = $pdo->prepare("SELECT * FROM images WHERE img_title LIKE CONCAT('%', :search ,'%') ORDER BY $sort $sdir;");
$stmt->execute($params);
// $stmt->debugDumpParams();
$data = $stmt->fetchAll();
$img_list = '
';
foreach ($data as $block) {
$img_list .= '- ';
$img_list .= '
';
$img_list .= ''.$block['img_title']."
";
$img_list .= ''.$block['img_desc']."
";
$img_list .= ' ';
}
$img_list .= '
';
echo $img_list;
}
function get_audio($pdo, $search='%', $sort='aud_date', $sdir='DESC') {
if ($sort != 'aud_date' && $sdir != 'ASC') {
if ($sort != 'aud_title' && $sdir != 'DESC') {
echo('Ey boss, database request is kinda f*cked up. Maybe you want to try that again, hey...
'.$sort.' '.$sdir);
die();
}
}
$params = array('search' => $search);
$stmt = $pdo->prepare("SELECT * FROM audio WHERE aud_title LIKE CONCAT('%', :search ,'%') ORDER BY $sort $sdir;");
$stmt->execute($params);
// $stmt->debugDumpParams();
$data = $stmt->fetchAll();
$aud_list = '';
foreach ($data as $block) {
$aud_list .= '- ';
$aud_list .= '';
$aud_list .= '
'.$block['aud_title']."
";
$aud_list .= ''.$block['aud_desc']."
";
$aud_list .= ' ';
}
$aud_list .= '
';
echo $aud_list;
}