首页 >后端开发 >php教程 >php sqlite_create_function函数的例子

php sqlite_create_function函数的例子

WBOY
WBOY原创
2016-07-25 08:57:441055浏览
  1. /**

  2. * sqlite_create_function函数示例
  3. * edit: bbs.it-home.org
  4. */
  5. define("PPO",400);
  6. function my($salary){
  7. return $salary / PPO;
  8. }
  9. $sqldb = sqlite_open("mydatabase.db");
  10. sqlite_create_function($sqldb,"myFunction", "my", 1);
  11. $query = "select myFunction(salary) FROM employee WHERE empid=1";
  12. $result = sqlite_query($sqldb, $query);
  13. list($myFunction) = sqlite_fetch_array($result);
  14. echo "The employee can purchase: ".$myFunction." ounces.";

  15. sqlite_close($sqldb);

  16. ?>
复制代码


声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn