While preparing a document in LaTeX, sometimes you might get a warning about the references and you have to rerun the compiler to get them correct, but my problem persisted even if I built the document tens of times. I spent ridiculous amount of time to figure out what the problem was. Basically, if your references within the document do not show up or appear to be wrong, please make sure that the captions for the tables and figures are defined above the label. Here is an example,

\begin{table} %or figure
...

\caption{here is my table}
\label{tab:table1}
\caption{here is my table}

\end{table}