I've started reading algebraic geometry by myself just a few days ago, so I apologize in advance if this question is stupid or non-sensical.
In Mumford's Red Book, he defines regular functions (although he doesn't use this notation, I'm assuming that he is defining the same thing; please correct me if I am wrong) as follows:
Definition 4 Let $X \subset k^n$ be an irreducible algebraic set, and let $R$ be its affine coordinate ring. Since $X$ is irreducible, $I(X)$ is prime and $R$ is an integral domain. Let $K$ be its field of fractions. Recall that $R$ has been identified with a ring of functions on $X$. For $x \in X$, let $m_x = \{f \in R | f(x) = 0\}$. This is a maximal ideal, the kernel of the homomorphism $R \to k$ given by $f \to f(x)$. Let $\underline{o}_x = R_{m_x}$. We have then $\underline{o}_x = \{f/g | f,g \in R, g(x) \ne 0\}$. Now, for $U$ open in $X$, let $$ \underline{o}_X(U) = \bigcap_{x \in U} \underline{o}_x.$$
I am assuming that $\underline{o}_X(U)$ is the set of regular functions on $U$ even though Mumford does not specify it. If I understand correctly, the rings $R_{m_x}$ are viewed by their embeddings in the field of fraction $K$, and the intersection is happening inside the field of fractions. Therefore, every element $\phi$ of $\underline{o}_X(U)$ is an element of the field of fractions $K$, and the way we view them as functions on $U$, say at a point $p$, is by first selecting $f, g \in R$ such that $\phi = f/g$ as elements of $K$ and $g(p) \ne 0$ when viewed as a function, and then defining $\phi(p) := f(p)/g(p) \in K$.
However, I became quite unsure about this after looking up other definitions. For example, Gathmann defines the set of regular functions on an open set $U$ of an affine variety $X$ as follows (I'll try to use the same notation as above here):
Definition 3.1 Let $X$ be an affine variety, and let $U$ be an open subset of $X$. A regular function on $U$ is a map $\phi: U \to k$ with the following property. For every $a \in U$, there are polynomial functions $f, g \in R$, with $f(x) \ne 0$, and $$ \phi(x) = \frac{f(x)}{g(x)}$$ for all $x$ in an open subset $U_a$ with $a \in U_a \subset U$.
In this definition, the function $\phi$ is no longer required to be given by an element of $K$; we only know that it is locally given by a quotient of two polynomials, and I am wondering if this quotient can be different as elements of the field of fractions $K$ at different points of $X$. I would like to know if these two definitions are saying the same thing. To be more specific, my question is:
Given such a regular function $\phi$ in the sense of the second definition, can we find an element $\phi' \in \underline{o}_{X}(U) \subset K$, such that $\phi = \phi'$ as functions on $U$?
Thanks for reading this long post.