Basically, I try to fetch player id it outputs id 17 it's a correct number and I'm pretty sure it's correct to there. Then use these values to get a list of trade info. The database looks like this:
function listtrade() {
    
    
    global $db;
    $damnid = usertouserid($usernick);
    //SQL queries really suck dude
    $dt = "SELECT * FROM trades WHERE tradereceiver = '$damnid' ORDER BY tradeid DESC";
    $dbdata = array();
    $tsr = mysqli_query($db, $dt);
    while ($dbdatadt = mysqli_fetch_assoc($tsr)) {
        $dbdata[] = $dbdatadt;
    }
    return $dbdata;
}
Steps I tried
- adding and removing '
- removing order by
but it does not solve, any reason this happens? It looks very dumb for me, it should run correctly, the syntax is correct.

 
     
    