OpenBiblio: Difference between revisions

Jump to navigation Jump to search
1,229 bytes added ,  6 June 2010
+version 0.6.1
m (3個修訂)
(+version 0.6.1)
Line 44: Line 44:
     '''$rc = Query::act( 'SET NAMES UTF8' );'''
     '''$rc = Query::act( 'SET NAMES UTF8' );'''
     return $e;
     return $e;
  }
; Modify PHP source (version 0.6.1)
openbiblio\classes\Query.php
add the two lines: '''mysql_query("SET CHARACTER SET utf8");''' and '''mysql_query("SET NAMES utf8");'''
so that all connection will be UTF8
  function _connect_e() {
    static $link;
    if (!isset($link)) {
      if (!function_exists('mysql_connect')) {
        return array(NULL, new DbError("Checking for MySQL Extension...",
                          "Unable to connect to database.",
                          "The MySQL extension is not available"));
      }
      $link = mysql_connect(OBIB_HOST,OBIB_USERNAME,OBIB_PWD);
      mysql_query("SET CHARACTER SET utf8");
      mysql_query("SET NAMES utf8");
      if (!$link) {
        return array(NULL, new DbError("Connecting to database server...",
                                      "Cannot connect to database server.",
                                      mysql_error()));
      }
      $rc = mysql_select_db(OBIB_DATABASE, $link);
      if (!$rc) {
        return array(NULL, new DbError("Selecting database...",
                                      "Cannot select database.",
                                      mysql_error($link)));
      }
    }
    return array($link, NULL);
   }
   }


Anonymous user

Navigation menu