当前位置: 首页>>代码示例>>PHP>>正文


PHP odbc_fetch_array函数代码示例

本文整理汇总了PHP中odbc_fetch_array函数的典型用法代码示例。如果您正苦于以下问题:PHP odbc_fetch_array函数的具体用法?PHP odbc_fetch_array怎么用?PHP odbc_fetch_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了odbc_fetch_array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getNextRow

 /**
  * Internal method to fetch the next row from the result set
  *
  * @return array|null
  */
 protected function getNextRow()
 {
     # If the result resource is invalid then don't bother trying to fetch
     if (!$this->result) {
         return;
     }
     switch ($this->mode) {
         case "mysql":
             $row = $this->result->fetch_assoc();
             break;
         case "postgres":
         case "redshift":
             $row = pg_fetch_assoc($this->result);
             break;
         case "odbc":
             $row = odbc_fetch_array($this->result, $this->position + 1);
             break;
         case "sqlite":
             $row = $this->result->fetchArray(SQLITE3_ASSOC);
             break;
         case "mssql":
             $row = mssql_fetch_assoc($this->result);
             break;
     }
     # If the fetch fails then there are no rows left to retrieve
     if (!$row) {
         return;
     }
     $this->position++;
     return $row;
 }
开发者ID:ian-Tr,项目名称:le-huard,代码行数:36,代码来源:Result.php

示例2: fetch_array

function fetch_array($resource_array)
{
    global $db_connection_type;
    switch ($db_connection_type) {
        case "odbc":
            $result = odbc_fetch_array($resource_array);
            break;
        case "mysql":
            $result = mysql_fetch_array($resource_array);
    }
    return $result;
}
开发者ID:edhrtiw,项目名称:openbookings-dot-org,代码行数:12,代码来源:connect_db.php

示例3: query

 public function query($sql)
 {
     $rs = odbc_exec($this->dbConnection(), $sql);
     if (is_resource($rs)) {
         while ($result[] = odbc_fetch_array($rs)) {
         }
         odbc_free_result($rs);
         $this->close();
         return $result;
     } else {
         $this->halt('Database query error', $sql);
     }
 }
开发者ID:huangbinzd,项目名称:kppwGit,代码行数:13,代码来源:odbc_driver.php

示例4: ImportData

function ImportData($objOdbc, $objMySql, $strTableName)
{
    global $objMySql;
    $objMySql->query("TRUNCATE `" . strtolower($strTableName) . '`;');
    $objResult = odbc_exec($objOdbc, "SELECT * FROM " . $strTableName . ";");
    print "Migrating " . odbc_num_rows($objResult) . " rows of data for " . $strTableName . "... [0]";
    $intCount = 0;
    while ($arrResult = odbc_fetch_array($objResult)) {
        print str_repeat(chr(8), strlen($intCount) + 1);
        $intCount++;
        print $intCount . ']';
        $strColumns = 'pkid';
        $strValues = 'NULL';
        foreach ($arrResult as $strKey => $strValue) {
            $strColumns .= ', `' . strtolower($strKey) . '`';
            if (strlen($strValue)) {
                $strValues .= ", '" . $objMySql->escape_string($strValue) . "'";
            } else {
                $strValues .= ', NULL';
            }
        }
        $strSql = sprintf('INSERT INTO `%s` VALUES (%s);', strtolower($strTableName), $strValues);
        $objMySql->query($strSql);
    }
    print " Done.\r\n";
}
开发者ID:alcf,项目名称:chms,代码行数:26,代码来源:acs-load-mysql.cli.php

示例5: execute

 /**
  *
  * @param type $query
  * @param type $type
  * @return type
  */
 public function execute($query, $type = null)
 {
     $result = array();
     switch ($this->db_engine) {
         case "pgsql":
             $resultado = pg_query($this->conn, $query);
             while ($row = pg_fetch_row($resultado)) {
                 $result[] = $row;
             }
             pg_close($this->conn);
             break;
         case "mssql":
             $resultado = odbc_exec($this->conn, $query);
             while ($row = odbc_fetch_array($resultado)) {
                 $result[] = $row;
             }
             break;
         case "mysql":
             $result = array();
             $resultado = mysql_query($query);
             if (gettype($resultado) == "boolean") {
                 $result = $resultado;
             } else {
                 while ($row = mysql_fetch_row($resultado)) {
                     $result[] = $row;
                 }
             }
             mysql_close($this->conn);
             break;
     }
     return $result;
 }
开发者ID:emildev35,项目名称:distribuidos,代码行数:38,代码来源:Conexion.php

示例6: db_fetch

 function db_fetch($oStmt)
 {
     if (function_exists(odbc_fetch_array)) {
         return odbc_fetch_array($oStmt);
     }
     return odbc_fetch_array_hack($oStmt);
 }
开发者ID:brustj,项目名称:tracmor,代码行数:7,代码来源:db_odbc.php

示例7: PegaData

function PegaData($banco)
{
    $sql = "SELECT GETDATE() as data ;";
    $result = mysql_query($sql, $conexao);
    $dados = odbc_fetch_array($result);
    return $dados['data'];
}
开发者ID:helderhlp,项目名称:intranet,代码行数:7,代码来源:parcela.php

示例8: listadoProductosPorSO

function listadoProductosPorSO($CODIGOSO)
{
    //realizamos la conexion mediante odbc
    $conn = odbc_connect("cnx_sistemaBD", "ANDREA", "1234") or die(odbc_errormsg());
    $consulta = "SELECT productos.CODIGOPRODUCTO, UPPER(productos.NOMBREPRODUCTO) As NOMBREPRODUCTO, \n    productos.DESCRIPCIONPUB, productos.PRECIOPUBLICO, productos.CANTIDADDISPONIBLE,  \n    productos.TIPOPRODUCTO, productos.ESPECIFICACIONTEC, productos.VIDEO,\n    FABRICANTES.NOMBREFABRICANTE , CATEGORIAS.NOMBRECATEGORIA\n    FROM productos, fabricantes, categorias where  \n    productos.FABRICANTES_CODFABRICANTE =FABRICANTES.CODFABRICANTE \n    and categorias.CODIGOCATEGORIA= productos.CATEGORIAS_CODIGOCATEGORIA AND productos.SISTEMAOP_CODIGOSO='" . $CODIGOSO . "'\n    ORDER BY productos.NOMBREPRODUCTO";
    //almacena el resultado de la consulta
    $resultado = odbc_exec($conn, $consulta) or die(odbc_errormsg());
    //exit($resultado);
    // echo get_resource_type ( $resultado);
    //crea variable de tipo array
    $SO = array();
    while ($row = odbc_fetch_array($resultado)) {
        array_push($SO, $row);
        //$SO = $row;
        // echo $row['CODIGOPRODUCTO'];
        //echo $row['DESCRIPCIONPUB'];
    }
    //return print_r($SO);
    if (!json_encode($SO)) {
        exit("problemas al imprimir con json_encode");
    } else {
        return json_encode($SO);
    }
    //cierra la conexion
    odbc_close($conn);
}
开发者ID:edinsonre,项目名称:proyecto-bajo-web-andrea-garcia,代码行数:26,代码来源:funciones.php

示例9: _import_db

    function _import_db()
    {
        //
        $sql = 'SELECT *
			FROM provedor
			ORDER BY nit';
        $result = $this->query($sql);
        while ($row = odbc_fetch_array($result)) {
            $this->p[] = $row;
        }
        odbc_free_result($result);
        unset($row);
        //
        $sql = 'SELECT *
			FROM constancia
			ORDER BY exencion';
        $result = $this->query($sql);
        while ($row = odbc_fetch_array($result)) {
            $this->e[] = $row;
        }
        odbc_free_result($result);
        unset($row);
        //
        $sql = 'SELECT *
			FROM factura
			ORDER BY exencion, factura';
        $result = $this->query($sql);
        while ($row = odbc_fetch_array($result)) {
            $this->f[] = $row;
        }
        odbc_free_result($result);
        //
        return;
    }
开发者ID:nopticon,项目名称:ei,代码行数:34,代码来源:class.php

示例10: head_cus

function head_cus($customer_no)
{
    $link = Fconectar();
    if ($link) {
        // Se define la consulta que va a ejecutarse, como en sql
        $sql_datos_cus = "\n\t\t\t\t\tSELECT C.par_cus_no, C.cus_no, C.cus_name, V1.slspsn_name AS Vendedor, V2.slspsn_name AS Cobrador, C.ar_terms_cd \n\t\t\t\t\tFROM\n\t\t\t\t\tARCUSFIL_SQL AS C,\n\t\t\t\t\tARSLMFIL_SQL AS V1,\n\t\t\t\t\tARSLMFIL_SQL AS V2\n\t\t\t\t\tWHERE\n\t\t\t\t\tC.slspsn_no = V1.slspsn_no AND\n\t\t\t\t\tC.collector = V2.slspsn_no AND\n\t\t\t\t\tC.cus_no = '{$customer_no}'\n\t\t\t\t";
        // Se ejecuta la consulta y se guardan los resultados
        $results = odbc_exec($link, $sql_datos_cus) or die("Error en instruccion SQL {$sql_datos_cus}");
        $existe = odbc_num_rows($results);
        if ($existe) {
            $registro = odbc_fetch_array($results);
            $head_cus_no = $registro['cus_no'];
            $head_cus_name = $registro['cus_name'];
            $head_ar_terms_cd = $registro['ar_terms_cd'];
            $head_slspsn_name = $registro['Vendedor'];
            $head_collector = $registro['Cobrador'];
        } else {
            $mensaje = "No existen registros!";
        }
    } else {
        Ferror("No se pudo establecer coneccion con la Base de Datos!");
    }
    // Se cierra la conexión
    odbc_close($link);
    echo "\n\t\t<div align='center'>\n\t\t<table width='40%' border='3' cellpadding='0' cellspacing='10' bordercolor='#DCF3A4' align='center'>\n\t\t\t<th colspan='2'>EDADES DE CARTERA POR CLIENTE (Datos hasta: " . date('d-m-Y') . ")</th>\t\n\t\t\t<tr>\n\t\t\t\t<td>Cliente:</td>\n\t\t\t\t<td>(" . number_format($head_cus_no, 0, '', '') . ") - {$head_cus_name}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>Vendedor:</td>\n\t\t\t\t<td>{$head_slspsn_name}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>Cobrador:</td>\n\t\t\t\t<td>{$head_collector}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>Condición de Pago:</td>\n\t\t\t\t<td>{$head_ar_terms_cd}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' align='center'>Generado: " . date('d-m-Y H:i:s') . "</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</div>\n\t\t";
}
开发者ID:KatherinAguilera,项目名称:ProtisaReportes,代码行数:26,代码来源:age_cxc_cus+-+copia.php

示例11: doquery

function doquery($query, $table, $fetch = false)
{
    global $link, $debug, $ugamela_root_path;
    @(include $ugamela_root_path . 'config.php');
    if (!$link) {
        $link = odbc_connect($dbsettings["server"], $dbsettings["user"], $dbsettings["pass"]) or $debug->error(odbc_error() . "<br />{$query}", "SQL Error");
        //message(mysql_error()."<br />$query","SQL Error");
        odbc_select_db($dbsettings["name"]) or $debug->error(odbc_error() . "<br />{$query}", "SQL Error");
    }
    // por el momento $query se mostrara
    // pero luego solo se vera en modo debug
    $sqlquery = odbc_exec($query, str_replace("{{table}}", $dbsettings["prefix"] . $table)) or $debug->error(odbc_error() . "<br />{$query}", "SQL Error");
    //message(mysql_error()."<br />$query","SQL Error");
    unset($dbsettings);
    //se borra la array para liberar algo de memoria
    global $numqueries, $debug;
    //,$depurerwrote003;
    $numqueries++;
    //$depurerwrote003 .= ;
    $debug->add("<tr><th>Query {$numqueries}: </th><th>{$query}</th><th>{$table}</th><th>{$fetch}</th></tr>");
    if ($fetch) {
        //hace el fetch y regresa $sqlrow
        $sqlrow = odbc_fetch_array($sqlquery);
        return $sqlrow;
    } else {
        //devuelve el $sqlquery ("sin fetch")
        return $sqlquery;
    }
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:29,代码来源:odbc.php

示例12: fetchData

 public function fetchData($sql)
 {
     try {
         $res = odbc_exec(self::connection(), $sql);
         //execute sql query	using db connection
         /*var_dump($res);*/
         if (!$res) {
             throw new Exception('odbc error code: ' . odbc_error() . '\\n sql query: ' . $sql);
         }
         $arrReturn = array();
         //define array to collect channel data
         //echo odbc_num_rows($res);
         while ($data = odbc_fetch_array($res)) {
             // check for all records returned
             $arrReturn[] = $data;
             //fetch data into return array from db resultset
         }
         self::closeConnection();
         // close db connection
         return $arrReturn;
         //return array back
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
开发者ID:vallepu,项目名称:my-project-dipak,代码行数:25,代码来源:fromDB.php

示例13: setStartCode

 public function setStartCode()
 {
     $query = 'SELECT TOP 1 MemberCardNo FROM POS_Member WHERE MemberCardNo LIKE \'T%\' ORDER BY Code DESC';
     $res = Processor::execErp($query);
     $member = odbc_fetch_array($res);
     $this->code = getArrayVal($member, 'MemberCardNo');
     return $this;
 }
开发者ID:jocoonopa,项目名称:lubri,代码行数:8,代码来源:MemberCode.php

示例14: to_array

 function to_array($res)
 {
     if ($array = odbc_fetch_array($res)) {
         return $array;
     } else {
         return false;
     }
 }
开发者ID:ricardoletelier,项目名称:conexion-mysqli-postgresql-desde-php,代码行数:8,代码来源:odbc.php

示例15: Query

 public function Query($sql)
 {
     $rs = odbc_exec($this->db_link, $sql);
     while ($row = odbc_fetch_array($rs)) {
         $rows[] = $row;
     }
     return $rows;
 }
开发者ID:jeann2013,项目名称:observatorio,代码行数:8,代码来源:class.odbc.php


注:本文中的odbc_fetch_array函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。