I'm writing simple math question generating program in PHP. There are users who add questions, and users who can examine themselves. For the questions with math formulas I am using LaTeX. But after inserting formula to MySQL database backslashes are removed and formula becomes unusable. Here is example of LaTeX formula:
\[
\mathbf{V}_1 \times \mathbf{V}_2 =
\begin{vmatrix}
\mathbf{i} & \mathbf{j} & \mathbf{k} \\
\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\
\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 \\
\end{vmatrix}
\]
And same formula after insertion to database:
[
mathbf{V}_1 imes mathbf{V}_2 =
egin{vmatrix}
mathbf{i} & mathbf{j} & mathbf{k}
frac{partial X}{partial u} & frac{partial Y}{partial u} & 0
frac{partial X}{partial v} & frac{partial Y}{partial v} & 0
end{vmatrix}
]
And how this formula shown after being rendered :
How can I prevent auto removing of backslashes?