setLogging(false); $as2db->setEMailOnError(false); } } return $as2db; } ?> 'Username', 3 => 'Apples', 4 => 'Bananas', 5 => 'Cherries'); $dir = GDO::getWhitelistedDirS($dir, 'DESC'); if (!in_array($orderby, $whitelist)) { return htmlDisplayError('Error 1010101: Not in whitelist.'); } $orderby = $db->escape($orderby); $query = "SELECT * FROM users ORDER BY $orderby $dir LIMIT 10"; if (false === ($rows = $db->queryAll($query))) { return false; } $headers = array( array('#'), array('Username', '1', 'ASC'), array('Apples', '3', 'DESC'), array('Bananas', '4', 'DESC'), array('Cherries', '5', 'DESC'), ); echo '
'.PHP_EOL; echo ''.PHP_EOL; echo GWF_Table::displayHeaders1($headers, GWF_WEB_ROOT.'challenge/order_by_query/index.php?by=%BY%&dir=%DIR%'); $i = 1; foreach ($rows as $row) { echo GWF_Table::rowStart(); echo sprintf('', $i++); echo sprintf('', $row['username']); echo sprintf('', $row['apples']); echo sprintf('', $row['bananas']); echo sprintf('', $row['cherries']); echo GWF_Table::rowEnd(); } echo '
%d%s%s%s%s
'.PHP_EOL; echo '
'.PHP_EOL; } ?>