Second, the differences are, in $DB->Query("Select * FROM time"); is with Object Oriented Programming in PHP, and $res = mysql_query("SELECT timestamp, name FROM time ORDER BY timestamp DESC"); is the normal way to do it...
The former is using object oriented programming aproach. $DB is an object and Query() is a method of that object. The later is classical procedural approach where mysql_query() is a function. Both do similar task I guess. You in general decide wheter to use object oriented programming or procedural.
Forget JQuery , has nothing to do with your examples. $DB in your example is an instance of a class (a data base handler class I guess). Object oriented programming has lot advantages, PHP has a very good class PDO , that will make your life easier and more secure if you spent a day or two learning it.