I am getting a mistake in PHP on the valid query, which executes fine when run from PHPMyAdmin.

Has anybody were built with a similar problem before and may point me within the right direction?

The mistake is below together with the function used the execute the query.

    [Error] => Invalid Query : SELECT * FROM users ORDER BY userDeleted ASC, userFullname ASC 
    [Error] => Empty MySQL resource. 

public function query($q){ 
        if(empty($q)) $this->dbError('Empty MySQL Query.'); 
        if($this->linkID == 0) $this->connect(); 
        $temp = @mysql_query($q, $this->linkID); 
        if(!$temp) $this->dbError('Invalid Query : '.mysql_error().'<br />'.$q); 
        return $temp; 


public function getUsers(){ 
    $q = "SELECT * FROM users ORDER BY userDeleted ASC, userFullname ASC"; 
    $result = $this->query($q);  

Update: The database is attached to via:

private function connect(){
            $this->linkID = @mysql_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
            if(!$this->linkID) $this->dbError('Could not connect: ' . mysql_error());
        return $this->linkID;   

    function select_db(){
            if(!@mysql_select_db(DB_NAME, $this->linkID)) $this->dbError('Can not use Database : ' . mysql_error());

You did not choose a database. This means that php (or phpmyadmin) has no clue which database your speaking about!

In the event that is not the situation, then it may be something related to your table setup. Putting @ on techniques hides all errors and alerts, which will work for production, for debugging... Not necessarily.

You can either did not choose a DB, or did not begin a link with the MySQL server (either that or it had not been available, maybe the server was lower or incorrect configurations/password?)

Remove each one of these @'s and run your code again.
Make certain you can observe errors happened.

Remove the @ symbols and find out in the event that shows any errors.