Re: How can a script tell if there's a MySQL problem?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bastien Koert wrote:
1. Make sure you are freeing up all resources as soon as you can ->
mysql_close();


little thing I've done for some time that's stuck with; (php5+ only)

on all of my database connection classes, I have the db close function in the destructor just to make sure

<?php

class MysqlConnection {

  protected $dbHandle; //holds the connection resource

  public function __destruct()
  {
    if(is_resource($this->dbHandle)) {
      mysql_close($this->dbHandle);
    }
  }

}

?>

just 'cos it's one less thing to worry about.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux