PHP/MySQL Database/sqlite create function
sqlite_create_function.php
<?php
define("PPO",400);
function my($salary){
return $salary / PPO;
}
$sqldb = sqlite_open("mydatabase.db");
sqlite_create_function($sqldb,"myFunction", "my", 1);
$query = "select myFunction(salary) FROM employee WHERE empid=1";
$result = sqlite_query($sqldb, $query);
list($myFunction) = sqlite_fetch_array($result);
echo "The employee can purchase: ".$myFunction." ounces.";
sqlite_close($sqldb);
?>