bibtex references out of order code example
Example 1: latex reference in order of appearance
\documentclass[12pt]{article}
\usepackage[sorting=none]{biblatex}
\bibliography{journals,phd-references} % Where journals.bib and phd-references.bib are BibTeX databases
\begin{document}
\cite{robertson2007}
\cite{earnshaw1842}
\printbibliography
\end{document}
Example 2: latex bibliography order of appearance
Use the unsrt package:
\bibliography{path/to/.bib}
\bibliographystyle{unsrt}