I read a tutorial on how to create your own Myspace script using PHP located here: http://www.upgradetheweb.com/2007/0...cecom-with-phppart-ii-designing-the-database/ Being a php beginner, i'm wondering if someone can tell me what each line of the following php code means: The database class // Class: DbConnector /////////////////////////////////////////////////////////////////////////////////////// require_once 'DbVars.php'; class DbConnector extends Dbvars { var $theQuery; function DbConnector(){ // Load settings from parent class $settings = Dbvars::getSettings(); // Get the main settings from the array we just loaded $this->host = $settings['dbhost']; // Connect to the database $this->link = mysql_connect($this->host, $this->user, $this->pass)or die(mysql_error()); function query($query) { $this->theQuery = $query function getSettings() { // Database variables change accordingly $settings['dbhost'] = 'localhost'
The first line, require_once includes the other php file. This is for including varibles or functions from that file. The next line creates a new PHP class called DbConnection Where there is function ... this create a new PHP function that can be then used in other files.