I am not sure if this is possible, but I'm trying to build a function that can build MYSQL queries.
It has a base query. If URL has a get value (script.php?game=AGame) it will take that get variable and rename it. The script will then append the required data needed to complete the MYSQL query accordingly.
    function build_query($getvar, $renamevar, $dbfield){
        $query = "SELECT * FROM release_dates ";
        $arguments = 0;
        if(isset($_GET['$getvar'])){
        $renamevar = $_GET['$getvar'];
        if($arguments >= 1){
                $query .= "AND  '$dbfield' = '$renamevar' ";
                $arguments = $arguments +1;
            }
            else{
                $query .= "'$dbfield' = '$renamevar' ";
            }
        }
    }
    build_query(g, game, game_title);
However, when running the code I get the following errors:
Notice: Use of undefined constant game - assumed 'game' in /www/sites/164/index.php on line 46
Notice: Use of undefined constant g - assumed 'g' in /www/sites/164/index.php on line 46
Notice: Use of undefined constant game_title - assumed 'game_title' in /www/sites/164/index.php on line 46
Any help would be appreciated.
 
    