Forum Moderators: coopster
$qry = "SELECT * FROM `$table` order by `$_GET[sortby]` desc limit $StartFrom, $Limit" WHERE `username` = "'.$session->username.'"';
your where needs to be first and then you order and limit
ESCAPE YOUR VARIABLES!
$table = addslashes($table);
$sortby = addslashes($_GET['sortby']);
$StartFrom = addslashes($StartFrom);
$Limit = addslashes($Limit);
$username = addslashes($session->username);
$qry = "SELECT * FROM `{$table}` WHERE `username` = '{$username}' ORDER BY `{$sortby}` DESC LIMIT {$StartFrom}, {$Limit};";
It's never a good idea to put $_GET variables directly into your SQL queries.
If you are using magic quotes - don't. If you were to move your code to another server where it wasn't enabled then your code would be open to SQL injection attacks.
I just thought I'd let you know in case you are using addslashes.
...and glad to have you around here :)