Just because you are connected to the database server does not mean that the query sent is guaranteed not to fail. As such, you still need to handle a possible error, and that is one (not very graceful) way of doing it.
Basically, it makes use of lazy evaluation for or: if mysql_query() returns a value that evaluates to true, the second part of the expression is not evaluated, hence the die() is not called. If it returns false, then the second part of the expression is evaluated, hence the script terminates immediately with the error message printed.