What's the scope of the $mysqli->query call? Mysqli is (rightfully) not a global resource like mysql was. So you cannot do this:
$mysqli = new Mysqli('localhost', 'user', 'password', 'db');
Since $mysqli doesn't exist outside the scope of connect.