Referring to a table in LaTeX [closed]

How can you refer to a table number such that you get Table 7 for instance?

Sample data

Table \ref{table:questions} lorem lorem ipsun.

\begin{table}
\label{table:questions}
\begin{tabular}{| p{5cm} | p{5cm} | p{5cm} |}
  -- cut --
\end{tabular}
\end{table}

I get

Table 2.5 lorem lorem ipsun.

where 2.5 is the chapter number.


Solution 1:

You must place the label after a caption in order to for label to store the table's number, not the chapter's number.

\begin{table}
\begin{tabular}{| p{5cm} | p{5cm} | p{5cm} |}
  -- cut --
\end{tabular}
\caption{My table}
\label{table:kysymys}
\end{table}

Table \ref{table:kysymys} on page \pageref{table:kysymys} refers to the ...