"In a finite commutative ring, prove every element is a unit or zero divisor." What happens if we drop "finite"? This was my ring theory exam question which states:

Let $R$ be a finite commutative ring with unity.Prove that every non-zero element of $R$ is either a zero-divisor or a unit.What happens if we drop "finite" condition on $R$?

I know I am wrong but I thought $R$ to be an integral domain.What should be correct way to solve it?
 A: Suppose $0\neq a\in R$ is a non-zero-divisor and consider the map $R\to R, ~ r\mapsto ar$. Prove that it is injective and hence bijective ($R$ is finite). Conclude that $a$ is a unit.
A: in an infinite commutative ring there is the third possibility of elements $x$ which are not divisors of zero or units - because the set $\{x^k\}$ is isomorphic to the free monoid on $\{x\}$. all $n \in \mathbb{Z}$ except $0,\pm1$ are of this type, and likewise for $\mathbb{Z[x]}$
A: 
What should be correct way to solve it?

Proving the given statement (with the finiteness conditon) would be a duplicate question of Every nonzero element in a finite ring is either a unit or a zero divisor, so I will direct you to the very good solutions that already exist there.

What happens if we drop "finite" condition on R?

$\Bbb Z$ is a commutative ring with unity which has exactly two units and (in my convention) only one zero divisor, and everything else is neither unit nor zero divisor. So deleting the word finite pretty much wrecks the statement. 

I know I am wrong but I thought $R$ to be an integral domain.

Well my example just now was an integral domain, but no, being a domain has nothing to do with it. The ring $F[x]/(x^2)$ for an infinite field $F$ is an infinite commutative ring with identity which isn't a domain and yet is partitioned between units and zero divisors.
So you can't just delete finite, but you can easily replace it with far more general adjectives.$^\ast$ Being finite is in no way necessary for elements to be partitioned between units and zero divisors. There are huge classes of infinite rings that have that property.
Probably the next simplest generalization of this question is to prove that for any right Artinian ring $R$, every element is a unit or zero divisor (I count $0$ among zero divisors.) Finite rings are of course left and right Artinian. But now you have, for example, every $n\times n$ matrix ring over a field, and every quotient of a polynomial ring over a field as examples beyond finite rings.
Actually you can go to something even more general called a strongly $\pi$ regular ring$^{\ast\ast}$. There is a simple proof for both claims at this question: Rings whose elements are partitioned between units and zero-divisors. and here.$^{\ast\ast\ast}$ 

$^\ast$  You can simply delete the word commutative, though.
$^{\ast\ast}$ A strongly $\pi$-regular ring is one which has the descending chain condition on chains of the form $xR\supseteq x^2R\supseteq x^3R\supseteq\ldots$
$^{\ast\ast\ast}$ There is also a related (but more oddly worded) post about this.
