Php – mysql connectivity breakdown



hello all,

I have a question here.

What really occurs when the chief page loads is a link is to be formed to the database server.

Its not happening which is the problem.

As $link returns null resulting the connection not to be recognized.

Whats the skip here??

See below functions part

         /**
         * Constructor
         *
         * @param string $host MySQL host address
         * @param string $user Database user
         * @param string $pass Database password
         * @param string $db_name Database name
         * @param boolean $persistant Is persistant connection
         * @param  boolean $connect_now Connect now
         * @return void
         */
        public function __construct($host, $user, $pass, $db_name, $persistant = true, $connect_now = true)
        {
                $this->host = $host;            // Host address
                $this->user = $user;            // User
                $this->pass = $pass;           // Password
                $this->db_name = $db_name;              // Database
 
                if ($connect_now)
                        $this->connect($persistant);
 
                return;
 
        }
 
         /**
         * Connect to the database
         *
         * @param boolean $persist Is persistant connection
         * @return boolean
         */
        public function connect($persist)
        {
                if ($persist)
                        $link = @mysql_pconnect($this->host, $this->user, $this->pass);
 
                else
                         $link = @mysql_connect($this->host, $this->user, $this->pass);
 
                //if (!$link)
                        //trigger_error('Could not connect to the database.', E_USER_ERROR);
 
                if ($link)
                {
                        $this->link = $link;
                        if ( @mysql_select_db($this->db_name, $link))
 
                                return true;
                }
 
               return false;
 
        }
 

see below the outcome of the code-

object(MySQLAdap)#2 (6) { ["host":"MySQLAdap":private]=> string(15) "192.168.1.1" ["user":"MySQLAdap":private]=> string(4) "user" ["pass":"MySQLAdap":private]=> string(8) "password" ["db_name":"MySQLAdap":private]=> string(8) "database" ["link":"MySQLAdap":private]=> NULL ["result":"MySQLAdap":private]=> NULL }

Kindly assist me.

Thank you!