Let $X$ be the curve $xy-z^2 \subset \mathbb{P}^2$, and let $f$ be the rational function $x/y$ (Edit: I'm trying to simplify this as much as possible, but of course $x$ itself isn't a rational function; my question is only about the divisor of zeros, but the same answer will tell me how to get the divisor of poles).
I am fine with the intuitive (and hand-wavy) method of computing the divisor of zeros (of $x$) by saying something like, "the line $x=0$ intersects $X$ at a single point with multiplicity 2, and so the coefficient of the point defined by their intersection (an irreducible codimension 1 subvariety) is 2."
I'm having trouble proving this in complete rigor using the definitions provided. In particular, if I have an irreducible codimension 1 subvariety $C$ in mind, I want to choose an affine open set $U \subset X$ intersecting $C$ and look at the local equation $\pi$ of $C$ in $U$. Here the ideal of $C$ in $U$ would hence be $(\pi)$, and necessarily for any $f \in k[U]$ there would be a maximal $m$ for which $f \in (\pi^m)$. The valuation of $f$ (and the coefficient of $C$ in the divisor) is defined to be $m$.
So I'm trying this with $C$ simply defined by $x=0$ (as a subvariety/point of $X$). The obvious affine chart is $y=1$, and then $k[U] = k[x,z]/(x-z^2)$. So now $x \in k[U]$, and it is its own local equation. However, it appears that $x \in (x)$, but $x \not \in (x^2) = (z^4)$, so the coefficient of $C$ would be 1.
This obviously doesn't fit with my intuitive understanding of how to compute the divisor of a rational function. I think the problem may be my misunderstanding of local equations, but I haven't yet been able to pinpoint the problem. What am I doing wrong?