I'm quite new to prepared statements and am not sure I am doing this right.

Here is what I try:
PHP Code:
$currgame 310791;

$sql "SELECT fk_player_id, player_tiles, player_draws, player_turn, player_passes, swapped FROM ".$prefix."_gameplayer WHERE fk_game_id = ?";
$stmt $mysqli->stmt_init();

$data = array();
if(
$stmt->prepare($sql)){
    
$stmt->bind_param('i'$currgame);
    
$stmt->execute();
    
$res $stmt->get_result();
    
    while (
$row $res->fetch_assoc()){
        
$data[] = $row;
    }
    
$stmt->close(); 
}

// to display own games
foreach ($data as $row) {
    if (
$row['fk_player_id'] == $playerid) {
        
        
$udraws $row['player_draws']+1
        
$upass $row['player_passes'];
        
$uswaps $row['swapped'];
        
        echo 
'uDraws: '.$udraws.'<br>';
        echo 
'uPass: '.$upass.'<br>';
        echo 
'uSwaps: '.$uswaps.'<br><br>';
    }
}
// to display other games
foreach ($data as $row) {
    if (
$row['fk_player_id'] != $playerid) {
        
        
$opponent $row['fk_player_id'];
        
$oppTiles $row['player_tiles'];
        
        
$odraws $row['player_draws']+1;
        
$opass $row['player_passes'];
        
$oswaps $row['swapped'];
        
        echo 
'oID: '.$opponent.'<br>';
        echo 
'oTiles: '.$oppTiles.'<br>';
        
        echo 
'oDraws: '.$odraws.'<br>';
        echo 
'oPass: '.$opass.'<br>';
        echo 
'oSwaps: '.$oswaps.'<br><br>';

    }

I get an "ServerError" when trying to run this: It is the "$res = $stmt->get_result();" that makes the error, but not sure why. Please help.

Thanks in advance :-)