Example #1
0
    }
    public function error($type = '')
    {
        //Choose error type
        if (empty($type)) {
            return false;
        } else {
            if ($type == 1) {
                echo "<strong>Database could not connect</strong> ";
            } else {
                if ($type == 2) {
                    echo "<strong>mysql error</strong> " . mysql_error();
                } else {
                    if ($type == 3) {
                        echo "<strong>error </strong>, Proses has been stopped";
                    } else {
                        echo "<strong>error </strong>, no connection !!!";
                    }
                }
            }
        }
    }
}
// example to use
$DB = new DBConfig();
$DB->config();
$DB->conn();
// mysql command
// mysql_query and others..
$DB->close();