phpsqlite_create_function函数的例子
时间:2021-07-01 10:21:17
帮助过:4人阅读
/** - * sqlite_create_function函数示例
- * edit: bbs.it-home.org
- */
- 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); - ?>
|