I've tried all different kinds of variations of this code and can't get it to work, can anyone point me in the right direction?
if(isset($_GET['s']) And isset($_GET['o'])) {
if(strip_tags(htmlspecialchars($_GET['s'])) === 's') $sortingby = 'sender';
if(strip_tags(htmlspecialchars($_GET['s'])) === 't') $sortingby = 'title';
if(strip_tags(htmlspecialchars($_GET['s'])) === 'd') $sortingby = 'timestamp';
if(strip_tags(htmlspecialchars($_GET['o'])) === 'a') $orderingby = 'ASC';
if(strip_tags(htmlspecialchars($_GET['o'])) === 'd') $orderingby = 'DESC';
echo '<br />';
echo $sortingby;
echo $orderingby;
}
$stmt = $pdo->prepare("SELECT * FROM messages WHERE
receiver = :id AND rhide = 0
ORDER BY :sortingby :orderingby
");
$stmt->execute(array(
':id'=>$id,
':sortingby'=>$sortingby,
':orderingby'=>$orderingby
));
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
The variables are assigned correctly when I echo them out, it just seems like my content is being ignored