[ Index ]

PHP Cross Reference of Nucleus CMS 3.32

title

Body

[close]

/nucleus/libs/ -> mysql.php (source)

   1  <?php
   2  
   3  /*
   4   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
   5   * Copyright (C) 2002-2007 The Nucleus Group
   6   *
   7   * This program is free software; you can redistribute it and/or
   8   * modify it under the terms of the GNU General Public License
   9   * as published by the Free Software Foundation; either version 2
  10   * of the License, or (at your option) any later version.
  11   * (see nucleus/documentation/index.html#license for more info)
  12   */
  13  /**
  14   * @license http://nucleuscms.org/license.txt GNU General Public License
  15   * @copyright Copyright (C) 2002-2007 The Nucleus Group
  16   * @version $Id: mysql.php 1116 2007-02-03 08:24:29Z kimitake $
  17   */
  18   
  19  /*
  20   * if no mysql_* functions exist, define wrappers
  21   */
  22   
  23  $MYSQL_CONN = 0;
  24  
  25  if (!function_exists('mysql_query'))
  26  {
  27      if (!function_exists('mysqli_query') && function_exists('startUpError'))
  28      {
  29          startUpError('<p>No suitable mySQL library was found to run Nucleus</p>');
  30      }
  31      
  32  	function mysql_query($query) 
  33      {
  34          global $MYSQL_CONN;
  35          return mysqli_query($MYSQL_CONN, $query); 
  36      }
  37      
  38  	function mysql_fetch_object($res) 
  39      { 
  40          return mysqli_fetch_object($res);
  41      }
  42      
  43  	function mysql_fetch_array($res) 
  44      { 
  45          return mysqli_fetch_array($res);
  46      }    
  47      
  48  	function mysql_fetch_assoc($res) 
  49      { 
  50          return mysqli_fetch_assoc($res);
  51      }    
  52  
  53  	function mysql_fetch_row($res) 
  54      { 
  55          return mysqli_fetch_row($res);
  56      }    
  57  
  58  	function mysql_num_rows($res)
  59      {
  60          return mysqli_num_rows($res);
  61      }
  62      
  63  	function mysql_num_fields($res)
  64      {
  65          return mysqli_num_fields($res);
  66      }
  67      
  68  	function mysql_free_result($res)
  69      {
  70          return mysqli_free_result($res);
  71      }
  72      
  73  	function mysql_result($res, $row, $col) 
  74      { 
  75          if (($row != 0) || ($col != 0)) {
  76              trigger_error('not implemented', E_USER_ERROR);
  77          }
  78          
  79          $row = mysqli_fetch_row($res);
  80          return $row[$col];
  81      }    
  82      
  83  	function mysql_connect($host, $username, $pwd)
  84      {
  85          return mysqli_connect($host, $username, $pwd);
  86      }
  87      
  88  	function mysql_error()
  89      {
  90          global $MYSQL_CONN;
  91          return mysqli_error($MYSQL_CONN);
  92      }
  93      
  94  	function mysql_select_db($db)
  95      {
  96          global $MYSQL_CONN;
  97          return mysqli_select_db($MYSQL_CONN, $db);
  98      }
  99      
 100  	function mysql_close()
 101      {
 102          global $MYSQL_CONN;
 103          return mysqli_close($MYSQL_CONN);
 104      }
 105      
 106  	function mysql_insert_id()
 107      {
 108          global $MYSQL_CONN;
 109          return mysqli_insert_id($MYSQL_CONN);
 110      }
 111      
 112  	function mysql_affected_rows()
 113      {
 114          global $MYSQL_CONN;
 115          return mysqli_affected_rows($MYSQL_CONN);
 116      }
 117  }
 118  
 119  
 120  
 121  ?>


Generated: Tue Feb 12 15:34:36 2008 Cross-referenced by PHPXref 0.7