I am working on web app for treasure hunt all connection to the online server is correct and the application is working fine and save and get the data from / to online mysql database.
on my application I register a session for (start time) and session for (end time) where the (end time) means that the user has finished the game.
I am getting the winner number from this (end time) and organize the winners based on there (end time)
the problem is that on localhost (using XAMPP) I get the winner number correctly. while if I upload my work to my hosting (Linux with CPanel) I always get the winner as 0 (even if it wasn't the first)
This is the result that I get online
while if I am on localhost I get the winner number correctly
this is the code to get the winner:
function getWinner($uid, $set){
    $db = new Db();
    $winner = 0;
    $query = "SELECT endtime FROM eid_race WHERE id = '$uid' AND endtime IS NOT NULL";
    $result = $db->query($query);
    if(sizeof($result) == 0){
        $updateEndtime = "UPDATE eid_race SET endtime = UNIX_TIMESTAMP() WHERE id = '$uid'";
        $db->execute($updateEndtime);
    }
        $query = "SELECT COUNT(id) FROM eid_race WHERE id <> '$uid' AND endtime IS NOT NULL AND endtime < (SELECT endtime FROM eid_race WHERE id = '$uid') AND questionset = '$set'";
    $result = $db->query($query);
    echo '  result:  ' . $result[0][0];
    if(sizeof($result) == 1){
        $winner = $result[0][0];
        echo '  winner:  '.$winner;
    }
    echo '  winner after:  '.$winner;
    return $winner+1;
}
when I test the query directly on phpmyadmin I get correct result but the php result still 0
SELECT COUNT(id) FROM eid_race WHERE id <> '577dd5759fa67' AND endtime IS NOT NULL AND endtime < (SELECT endtime FROM eid_race WHERE id = '577dd5759fa67') AND questionset = 'A'


