Proposition about regular functions on an affine variety I have the following basic issue:
Let $X$ be an affine variety in $\mathbb{A}_{k}^ {n}$. Co-ordinate ring of $X$ be  $A(X):= k[x_1,\ldots ,x_n]/I(X)$ whereas $K(X)$ be its quotient field.
$$ \mathcal{O}_{X,p}:=\{f/g :g(p)\neq0; f,g\in A(X)\} \\
\mathcal{O}_{X}(U):= \bigcap_{p \in U} \mathcal{O}_{X,p}$$ 
Where $\mathcal{O}_{X}(U)$ be known as the regular functions on open subset $U$.
Now consider the proof of following proposition: A set map $\phi:U \rightarrow k$ is regular, then for each $p \in U$ it has a neighborhood $V$ such that there are $f,g \in k[x_1, \ldots ,x_n]$ with $g(q)\neq 0$ and $\phi (q)= f(q)/g(q) \; \; \forall q \in V$
By definition $\phi \in \mathcal{O}_{X}(U) \implies \phi \in \mathcal{O}_{X,p}\;\; \forall p\in U$. Hence $\phi(p)=f_{p}(p)/g_{p}(q)$[Here the subscripted $p$ is for indexing the representation at a point $p$]. I can also find a neighborhood $V_{p}$ where $g_{p}(q)\neq 0$. But how do I relate representation of $\phi$ at $p$ with representation at another point $q\in V_{p}$? It might happen that $\phi (q)= f_{q}(q)/g_{q}(q)\neq f_{p}(q)/g_{p}(q).$
 A: Your comment was: "Let $X$ be an affine variety in $\mathbb{A}^n_k$. Let the co-ordinate ring of $X$ be $A(X):=k[x_1,…,x_n]/I(X)$ where $K(X)$ is its quotient field.
$\mathcal{O}_{X,p}:=\{f/g:g(p)≠0;f,g∈A(X)\}$ and let $ \mathcal{O}_{X}(U):=\cap_{p \in U}\mathcal{O}_{X,p}$
Where $\mathcal{O}_X(U)$ by definition is the ring of regular functions on the open subset $U$."
A possible answer is: If $A:=k[x_1,..,x_n]/I$ where $I$ is a prime ideal and $X:=Spec(A)$ we define the stalk
I0. $\mathcal{O}_{X,p}:= lim_{p \in U} \mathcal{O}_X(U)$ as a limit.
Since $X$ is an integral scheme ($A$ is an integral domain) it follows there is an isomorphism
I1. $\mathcal{O}_{X,p} \cong \cap_{p \in U}\mathcal{O}_X(U)$
for any point $p\in X$.
Your question: "I completely understand what you are trying to say. But you see, I am trying to solve the above mentioned issue directly from the definition of $\mathcal{O}_{X,p}$ and the definition of stalk I've presented here doesn't have any mention of neighborhood. Thank for your replies btw!"
Answer:
We may take intersection in I1 since there is an inclusion of rings $\mathcal{O}_X(U) \subseteq K(A)$ for any open set $U$. Hence the intersection in I1 takes place inside the quotient field $K(A)$ of the integral domain $A$. If the rings $\mathcal{O}_X(U)$ for varying open sets $U$ are not embedded into one fixed ring, you cannot "take intersections". In general when $X:=Spec(A)$ is any affine scheme you cannot in general embed $\mathcal{O}_X(U)$ into one fixed ring $K$ for all open sets $U$. This is why the stalk in I0 is defined using "limits".
When you define the stalk $\mathcal{O}_{X,p}$ using a limit as in I0, it follows any element $u\in \mathcal{O}_{X,p}$  has a representative on the form $(U,s)$ where $p\in U \subseteq X$ is an open set and $s\in \mathcal{O}_X(U)$ is a section on $U$. You may find this on page 62 in Hartshorne. Hartshorne comments that any element in $\mathcal{O}_{X,p}$ is an equivalence class $\overline{(U,s)}$ where $(U,s) \cong (V,t)$ iff there is an open set $p\in W \subseteq U \cap V$ with $t_W=s_W$.
In general if $X$ is any topological space and $F$ any sheaf of abelian groups on $X$ with $x \in X$ any point, let
$i_x: \{x\} \rightarrow X$
be the inclusion map. It follows by definition
$i_x^{-1}(F):= lim_{x\in U} F(U)\cong F_x$,
where $F_x$ is the stalk of $F$ at $x$.
Hence we may use the canonical map $i_x$ to define the stalk $F_x$. The inverse image $i_x^{-1}F$ is defined on page 65 in Hartshorne, and there you will find the precise definition of this "limit".
A: No, this is not possible. Remember that $\phi(x)=f_p(x)/g_p(x)$ on the open neighborhood $V_p$, and  $\phi(x)=f_q(x)/g_q(x)$ on the open neighborhood $V_q$. So $\frac{f_p(x)}{g_p(x)}=\frac{f_q(x)}{g_q(x)}$ on $V_p\cap V_q$.
