The most basic summation formula in the theory of q-hypergeometric functions is the well-known q-binomial formula. Not so well-known is the fact that there is a bilateral extension of it due to Ramanujan, and that there are two integral analogues of it. We show that these summation formulas as well as their integral counterparts have essentially the same origin, namely, a Pearson-type difference equation on a q-linear lattice. It is shown that the boundary conditions determine the structure of the solution of this equation which also enables us to evaluate the sums and integrals by a systematic process of iteration. We conclude by giving a very simple derivation of the q-Gauss formula and a second summation formula for a nonterminating 2ф 1 series.