Retarded question, I'm sure...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jim
Forum Contributor
Posts: 238
Joined: Fri Apr 19, 2002 5:26 am
Location: Near Austin, Texas

Retarded question, I'm sure...

Post by Jim »

I've been looking through some PHP scripts on PHPbuilder.com, and I've run through this kind of code once more.

Code: Select all

// connection parameters 
    var $host = '';
    var $user = '';
    var $pass = '';
    var $database = '';
    var $persistent = false;
    var $link = NULL;
    var $result = false;

    // Constructor
    // Initializes member variables
    function DB($host, $user, $pass, $database='', $persistent = false) {
        $this->host = $host;
        $this->user = $user;
        $this->pass = $pass;
        $this->database = $database;
        $this->persistent = $persistent;
    }
I'd like to know what "$persistent" is for. I don't really understand why it's necessary if it's always set to false anyway. What does it mean? I'm assuming it means that the MySQL connection won't stay open after the execution of the script, but I'm not entirely sure.

Help with understanding would be greatly appreciated!

Thanks!

-Jim
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

false is just the default value of persistant, you could pass the value true to the method if you wanted.
Post Reply