//////////////////////////////////////////////////////////////////////////////////
/// Config (ٸ Ͽ ϰ include ϵ ϸ ǰ..)
//////////////////////////////////////////////////////////////////////////////////
$DBConf['host']         = ":/tmp/mysql.sock";    
$DBConf['database']     = "************";              // 
$DBConf['user']         = "********";                  // 
$DBConf['passwd']       = "****";                      // йȣ
$DBConf['debug']        = "Y";                         // 񿡷 echo Ѵ. "Y" 
                                                       //   ѱ.. else..
$ErrorPage['dberror']   = "../errorPage/dbErrorPage.php";



//////////////////////////////////////////////////////////////////////////////////
/// ̿ϱ                                                                   ///
//////////////////////////////////////////////////////////////////////////////////

//////////////////////
// #1 ()
//////////////////////
    $mysql = new MysqlClass; // OR  $mysql = new MysqlClass("host","id","pass","dbname");
    // ⺻  س.. ޸𸮿 ø.
    // ̶ Connect  ʴ´.
    //  Connect Ű.. $mysql->connect();


//////////////////////
// #2 (⺻ )
//////////////////////
    $query = "
        SELECT *
          FROM table_name
         WHERE someCondition = 'XXX'
    ";
    $mysql->query($query);
    while($row = $mysql->fetch())
    {
        print_r($row);
    }
    // $mysql->fetch()  mysql_fetch_assoc()  Ѵ.
    // $mysql->fetch_assoc(), $mysql->fetch_array(), $mysql->fetch_row(), $mysql->fetch_object()  ȴ.


//////////////////////
// #3 (񺯰)
//////////////////////
    $mysql->select_db('someDbName');


//////////////////////
// #3 (Lock Table)
//////////////////////
    $lockInst = array("firstLockTableName"=>"LockType", "secondLockTableName"=>"LockType");
    $mysql->lock($lockInst);

    // UnLock
    $mysql->unlock();
    // close()  ڵ   Ѵ.


//////////////////////
// #4 ( )
//////////////////////
//   row 1 
    $query = "
        SELECT *
          FROM table_name
         WHERE primaryKeyColumn = 'value'
    ";
    $returnAssocArray = $mysql->one_row($query);
    // $returnAssocArray  Į Key  迭 ٷ ̾ƿ.


//////////////////////
// #5 ( )
//////////////////////
//   row 1, colomn 1 
    $query = "
        SELECT count(*)
          FROM table_name
    ";
    $return = $mysql->get_one($query);
    // $return  ٷ Եȴ.


//////////////////////////////////////////////////////////////////////////////////
   ٿ ôµ..
⺻ default include  $mysql ڿ ϰ..
 Ǵ  connect  ϴ  ѰԴϴ.
  footer  .. װ..$mysql->close()   ִ° .

Ʒ κ ÷ָ.. ݻ÷ȭ Դϴ.

function userAbortFunc()
{
    global $mysql;
    if(is_object($mysql)) $mysql->close();
}
ignore_user_abort(true); 
register_shutdown_function('userAbortFunc');