added mysql cursor and select statement