Change active hover image src

Change active hover image src

Can someone please help, cause I don't understand how this cannot work!!???

I am trying to write a small function that would replace a picture src when hovered (see code below)

- $(".myimgisthis").hover(function(){
var oldimg = $(".myimgisthis img").attr("src");
var newimg = $(".fiimgi img").attr("src");
$(this).attr("src", newimg);
}, function(){
$(this).attr("src", ouimg);

The reason why I want to use variables and $(this) situations, is because I need this function to work on an PHP output of a SQL I am not aware of the old image and new image src (otherwise this could be so much easier).

Can someone please help?