Sure, simply create a separate page called "functions.php" and on each PHP page where you require the use of the function issue the following:
require("functions.php");
It's really that easy.
Remember, any time you pass a variable to MySQL make sure you mysql_escape_string() first to avoid the possibility of SQL injection attacks.