You store the name of the function in the database as a string; so if you had a function foo(), you could store 'foo' in the database.
To use it, get it out of the database like any ordinary string, put it in a variable, say $bar. Then to use it, go
$bar();
See the manual's section on Variable Functions, in Chapter 8, for more detail.