Thule - 0.9.6
  • Welcome
  • Introduction
  • - MVC(Model-View-Controller)
    - Architecture of Framework
    - Flow Chart of Application
    - Services In One Server
    - Developing Guide
    - Features
  • Installation
  • Getting Started
  • - Direct Access HTTP
    - Router Access HTTP
    - Router Direct Access HTTP
    - Reserved Function
    - Convention
    - Bootstrap
    - Pack Javascript , CSS
  • Basic Modules
  • - Model
    - View
    - Controller
  • Libraries
  • - Router
    - Config
    - Response
    - Request
    - Database
    - Query
    - Cache
    - Debug
    - Log
    - Unit Test
    - Registry
    - Profile
  • Helper
  • - Auth
    - Calendar
    - Date
    - Error page
    - Email
    - Form
    - GeoIP
    - Google
    - Html Element
    - Html
    - Http
    - I18n
    - Image
    - Json
    - Jquery
    - Login
    - Layout
    - Locale
    - PHP to Javascript
    - Paging
    - Payflow
    - Soap
    - Text
    - Table
    - Uri
    - Upload
    - Validation
  • Plugins
  • - Smarty Template Engine
  • History
  • Home > Database

    Database class provides very convenient ,simple and powerful way to query to database.
    It is easy to add the configure database like below.

    Configure

    Database/confg/dbconfig.php

    $hDB['default']=array('servertype'=>'mysql',
                    'hostname'=>'192.168.29.128',
                    'user'=>'root',
                    'password'=>'',
                    'port'=>'3306');

    How to use above configuration.


    $hconn=$this->opendb('default');

    Direct query

    You can query to database directly in models class.

    $hconn=$this->opendb('default');
    $objModel= new Model($hconn);
    $result=$objModel->query("select * from TB_thule;");

    Object Result.

    You can get the result from mysql as "Object" with setup the configure.ini .

    mysql_result_type = "object" ; object ,array

    you can call the value with oject instead of array like below.

    $result->field_name;

    Further more..

    However there is strong way for query maintenance and for database administrator to handle.
    Below is example . If you want more information, go to Model chapter.

    $objSample=new SampleModel($hconn);
    $result=$objSample->query("select * from DB_FRAMEWORK.TB_POST;");
    foreach($result[0] as $var=>$value) {
          $this->setResponse($var,$value);
    }

    $arr_sql['member_id']=1;
    $objSample->update_member($arr_sql);
    $result=$objSample->select_member($arr_sql);
    foreach($result[0] as $var=>$value) {
          $this->setResponse($var,$value);
    }