Remember, anytime you use $this, it refers to variables or functions that are created within that class only. So, to start, at the beginning of your script, you'll also want to declare
var $insert;
var $query;
Now, for your function, anytime you're wanting to work with a variable from inside...