Just in case you didn't know. You can use mysql_connect in a function to connect to a database and the ...
cct.me.ntut.edu.tw