Scope and MySQLi binding
===

I've been using the old MySQL library for PHP for ages now and I've finally caved into using MySQLi. Prepared statements seem very useful, so I'm trying to get the hang out them.

Right now I'm creating some prepared statements and binding their parameters globally, and then using a function to execute them like this:

    $stmt = $mysqli->prepare("INSERT ...");
    $stmt->bind_param("ss", $var1, $var2);

    function process($t) {
        global $mysqli, $stmt;
        $var1 = $t['var1'];
        $var2 = $t['var2'];
        $stmt->execute();
    }

The problem I'm running into is that the execute function runs into an error where the variables are still null. Should I be binding/unbinding as I gather values from `$t`?