Some things to say at first glance:
1) don't use die(), throw an exception;
2) don't use function arguments to change the behavior of a function so much - better use two functions, which leads to using a class with 2 methods;
3) don't use internal variables to configure the data connection (i.e. $server), better pass this to the constructor (assuming you use a class as said in 2) )
4) in fact, it's not a Database class/function, it's MySQL_Database class/function

What will happen to your function if you need PostGreSql e.g.

PS: Even by having only the name of your function, it must be implemented as a class

- it's a noun and there is no verb in it.