Let $f(x,y)$ be a realvalued function on the unit square $[0,1]^2$. Suppose that $f(x,y)$ is Riemann integrable along each straight line. Does this imply that $f$ Riemann integrable on the square? Does the answer change if we only suppose that $f$ is integrable along all vertical lines $x=c$ and integrable along all horizontal lines $y=c$?
No, consider the function $$g(x,y) = \cases {0,&if $(x,y)=(0,0)$\\ xy^2/(x^2+y^6) &otherwise}$$ taken from Exercise 4.7 of Baby Rudin (3ed) via this Math.SE post. Along every line it is continuous and hence Riemann integrable, but it is unbounded along the curve $x=y^3$, and an unbounded function cannot be Riemann integrable.

1$\begingroup$ The OP deleted a followup question asking the same question for hyperplanes in the $n$cube, but for the record the answer is still no. A simple counterexample suggested by @Nate Eldredge's answer: Let $f$ be the function that takes $(1/k, 1/k^2, 1/k^3, \ldots, 1/k^n)$ to $k$ for each positive integer $k$, and takes everything else to zero. Each hyperplane meets at most $n$ of those points, so the integral of $f$ on any hyperplane vanishes; but again the function is not bounded on the cube, hence is not Riemann integrable. $\endgroup$ – Noam D. Elkies Jan 16 at 4:18

$\begingroup$ Thank you for the answer and reference, Nate. I actually had meant to include the condition that $f$ is bounded. As I forgot and you answered the question that I did ask, I accepted. Do you know though of an example or reference for the case when we add the condition that f is bounded? If not, would it be ok if I edit this question to ask what I had intended, or is it better to ask in a separate thread? Also sorry for deleting the follow up. I wasn’t sure if I should leave it since I accepted an answer that focused on the main question. $\endgroup$ – Yacoub Kureh Jan 16 at 5:40

$\begingroup$ Thanks, @NoamD.Elkies for the answer to the $n$cube question. If I may ask, are these types of unbounded functions the only way to construct counterexamples? As I mentioned in my comment above, I had intended to ask about bounded functions. The type of counterexample I was imagining (but couldn't come up with) was a function that had discontinuities on a set $E\subset [0,1]^2 $ that has a positive ("area") measure in $[0,1]^2$ but the intersection of $E$ and any straight lines would have zero ("length") measure. $\endgroup$ – Yacoub Kureh Jan 16 at 7:31

5$\begingroup$ @YacoubKureh: You can find a countable set $A$ which is dense in $[0,1]^2$, and which intersects any line in at most two points (recursively: choose a sequence of balls which is a basis for the topology in $[0, 1]^2$, and in $n$th step add a point which is in the $n$th ball and which does not lie on any line containing any two of previously chosen points). Then the characteristic function of $A$ does the job: it is discontinuous everywhere, but its restriction to any line is zero except at no more than two points. $\endgroup$ – Mateusz Kwaśnicki Jan 16 at 9:01