Login   Register  
PHP Classes
elePHPant
Icontem

File: example_add_wordlist.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of David Frendin  >  lib_dictionary  >  example_add_wordlist.php  >  Download  
File: example_add_wordlist.php
Role: Example script
Content type: text/plain
Description: example for populating the dictionary
Class: lib_dictionary
Check text spelling with a dictionary in MySQL
Author: By
Last change:
Date: 2007-05-14 15:49
Size: 1,391 bytes
 

Contents

Class file image Download
<?php
/***************************************************************************
 *   example_add_wordlist.php
 *   Copyright (c) 2007 David Frendin (david.frendin@gmail.com)
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version. See the GNU General Public License
 *   for more details.
 *
 ***************************************************************************/

/***************************************************************************
 *   Example: How to add a new wordlist
 *   This example will append words from a textfile to the dictionary
 *
 ***************************************************************************/


/* ___[ Below is example code ]_____________________ */
require_once('mysql4.php');    //from phpbb2
require_once('lib_dictionary.php');

define('DICTIONARY_TABLE''dictionary');

//connect to db
$db = new sql_db('localhost''username''password''table'false);
if(!
$db->db_connect_id)
{
    die(
"Could not connect to the database");
}

$dict = new dictclass();

$dict->add_from_file("some_wordlist.txt");        //<-- the magic command
die("done!");

/* ___[ End of example code ]_____________________ */
?>