Creating a Search Application -
(Page 12 of 29 )
The constructor of the harvesting class will perform two tasks. One, it will connect to the database by utilizing the database class we created earlier. Secondly, it will take a string containing the URLs and separate them and place them in an array. The first step of this is to use the trim function to remove any excess newlines or spaces from the beginning and end of the data. Then, we will use the explode function to break the data down into an array. The resulting array will be stored in the class variable $_urlarray.
<?php function Harvest_Keywords($urls) { $this->_db = new DB_Class('test', 'username', 'password'); $this->_urlarray = trim ($urls); $this->_urlarray = explode ("\n", $this->_urlarray); } ?> |
It is in this function that you must change the database values to reflect your personal settings.
Next: >>
More Database Articles Articles
More By Matt Wade