Error: \caption outside float

Check carefully your document when such errors pop out; before the editing to the question, the second begin{table} wasn't preceded by the backslash. In this case LaTeX is happy to print "begintable[h]" and then start the center environment.

If you had proceded on by hitting return at the error message you'd have seen another one telling you that the document environment had been closed by table.

By the way, don't use the center environment in this situation:

\begin{table}
\centering
<table data>
\caption{The caption}\label{thelabel}
\end{table}

The second table started with

begin{table}[h]

instead of

\begin{table}[h]

meaning it missed a \ and that was what gave the error of a caption outside a float.