server-php-sqlite-demo-function.php / php
<?php /* determine the difference between the user supplied string and the one in the database based on the contained characters */ function char_compare(user_str) { return similar_text(user_str); } /* Create char_compare() function inside SQLite based on our PHP function, char_compare(). The 3rd parameter indicates how many arguments the function requires */ db->createFunction('char_compare', 'char_compare', 2); /* Execute query, where char_compare() is used to perform the string comparison between name & specified string */ db->arrayQuery("SELECT name, char_compare(name, 'Il2') AS sim_index FROM foo", SQLITE_ASSOC); print_r(
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.