Example of php sqlite_create_function function

WBOY
Release: 2016-07-25 08:57:44
Original
1046 people have browsed it
  1. /**

  2. * sqlite_create_function function example
  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. ?>

复制代码


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template