日期:2013-04-26  浏览次数:20400 次

class_mysql.php

<?php

//######################################################################
//##### TITLE       :: CLASS MYSQL
//##### FILE        :: class_mysql.php
//##### PROJECT     :: WebVision
//##### RELATED DOCUMENT :: None
//##### DESCRIPTION   ::
//#####     To provide access utility for MySQL access
//#####     RunDB is used to run SQL query with the result
//#####     grouped into array.
//##### AUTHOR      :: Mark Quah
//##### REVISION  ::
//######################################################################

class MYSQL
{
    var $no_rows=0, $row=array();
    var $no_fields=0, $field=array();

    //#-----------------------------------------------------------------
    //#---- FUNCTION :: MYSQL($p_host, $p_user, $p_passwd, $p_db="mysql")
    //#---- DESCRIPTION  ::
    //#----      Initialize class with information to access server
    //#----      No connection will be made at this point.
    //#---- INPUT ::
    //#----      p_host      : server hostname|IP address
    //#----      p_user      : user name to log into server
    //#----      p_passwd    : passwd for the user
    //#----      p_db        : database to be used
    //#---- OUTPUT ::
    //#----      none
    //#-----------------------------------------------------------------
    function MYSQL($p_host, $p_user, $p_passwd, $p_db="mysql")
    {
        $this->sql_host = $p_host;
        $this->sql_user= $p_user;
        $this->sql_passwd = $p_passwd;
        $this->sql_db = $p_db;
    } // end MYSQL

    //#-----------------------------------------------------------------
    //#---- FUNCTION :: RunDB($statement, $exp_result = "")
    //#---- DESCRIPTION ::
    //#----      Execute a MySQL statement in a non-persistant mode
    //#---- INPUT    ::
    //#----      p_statement : statement to be executed
    //#----      exp_result  : is result expected?
    //#----           value 1 (default): result stored in row array
    //#----           value 0: result not stored in row array
    //#---- OUTPUT   ::
    //#----      return "OK"        : succesful
    //#----      return err_message from mysql_connect
    //#----      exp_result==1: additional result stored into array row
    //#--