We consider a fractional equation involving the left and right Riemann–Liouville fractional integrals and with Sturm–Liouville boundary-value conditions. We establish the variational structure of the problem and, by using critical-point theory, the existence of an unbounded sequence of solutions is obtained.