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


PHP sqlsrv_num_rows函数代码示例

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


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

示例1: getProveedoresByFilter

 static function getProveedoresByFilter($filter)
 {
     $conn = ExternalDao::getConnection();
     $result = new \stdClass();
     $proveedores = array();
     $sqlCount = "select  * from vt020_proveedor p   where p.n_proveedor not like '%NO USAR%' ";
     $sqlData = "select top " . ($filter->pageSize + $filter->pageSize * ($filter->currentPage - 1)) . " c_proveedor, rtrim(ltrim(p.n_proveedor)) as n_proveedor, f.c_proveedor_primario as es_fresco " . "from vt020_proveedor p " . "left join VT020_PROVEEDOR_FRESCOS f on f.c_proveedor_primario = p.c_proveedor " . "where p.n_proveedor not like '%NO USAR%' ";
     $sqlExept = "select top " . $filter->pageSize * ($filter->currentPage - 1) . " c_proveedor, rtrim(ltrim(p.n_proveedor)) as n_proveedor , f.c_proveedor_primario as es_fresco " . "from vt020_proveedor p " . "left join VT020_PROVEEDOR_FRESCOS f on f.c_proveedor_primario = p.c_proveedor " . "where p.n_proveedor not like '%NO USAR%' ";
     if ($filter->multicolumnSearchText) {
         $where = "  and ( cast(c_proveedor as varchar(50)) like '%" . $filter->multicolumnSearchText . "%' or lower(p.n_proveedor) like '%" . strtolower($filter->multicolumnSearchText) . "%') ";
         $sqlCount = $sqlCount . $where;
         $sqlData = $sqlData . $where;
         $sqlExept = $sqlExept . $where;
     }
     if (isset($filter->userId) && $filter->userId) {
         $users_proveedor = SecurityDao::getUserProveedores($filter->userId);
         $proveedorIds = Phinq::create($users_proveedor)->select(function ($item) {
             return $item->proveedorId;
         })->toArray();
         $ids = implode(" , ", $proveedorIds);
         if (!$ids) {
             $ids = '-1';
         }
         $where = "  and c_proveedor in ( " . $ids . ") ";
         $sqlCount = $sqlCount . $where;
         $sqlData = $sqlData . $where;
         $sqlExept = $sqlExept . $where;
     }
     $sqlExept = $sqlExept . "  order by N_PROVEEDOR";
     $sqlData = $sqlData . " EXCEPT " . $sqlExept;
     //echo $sqlData;
     //region Count
     $params = array();
     $options = array("Scrollable" => SQLSRV_CURSOR_KEYSET);
     $stmt = sqlsrv_query($conn, $sqlCount, $params, $options);
     if ($stmt == false) {
         die(print_r(sqlsrv_errors(), true));
     }
     $count = sqlsrv_num_rows($stmt);
     sqlsrv_free_stmt($stmt);
     //endregion
     //region data
     $stmt = sqlsrv_query($conn, $sqlData, null);
     if ($stmt == false) {
         die(print_r(sqlsrv_errors(), true));
     }
     while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
         $proveedor = new \stdClass();
         $proveedor->id = $row['c_proveedor'];
         $proveedor->razonSocial = $row["n_proveedor"];
         $proveedor->esFresco = $row["es_fresco"];
         array_push($proveedores, $proveedor);
     }
     sqlsrv_free_stmt($stmt);
     sqlsrv_close($conn);
     //endregion
     $result->data = $proveedores;
     $result->count = $count;
     return $result;
 }
开发者ID:pablozabo,项目名称:Diarco,代码行数:60,代码来源:ExternalDao.php

示例2: get_count

function get_count($MID)
{
    $query = "SELECT * FROM riot4.users WHERE logged_MID = ?";
    $params = array($MID);
    $statement = sqlsrv_query($conn, $query, $params);
    return sqlsrv_num_rows($statement);
}
开发者ID:RIoT-MSCC,项目名称:Website-Server,代码行数:7,代码来源:session.php

示例3: num_rows

 /**
  * Number of rows in the result set
  *
  * @return	int
  */
 public function num_rows()
 {
     // sqlsrv_num_rows() doesn't work with the FORWARD and DYNAMIC cursors (FALSE is the same as FORWARD)
     if (!in_array($this->scrollable, [FALSE, SQLSRV_CURSOR_FORWARD, SQLSRV_CURSOR_DYNAMIC], TRUE)) {
         return parent::num_rows();
     }
     return is_int($this->num_rows) ? $this->num_rows : ($this->num_rows = sqlsrv_num_rows($this->result_id));
 }
开发者ID:DeDoOozZz,项目名称:brighterycms,代码行数:13,代码来源:sqlsrv_result.php

示例4: num_rows

 public static function num_rows($queryDB = '', $objectStr = '')
 {
     $numRows = sqlsrv_num_rows($queryDB);
     if (is_object($objectStr)) {
         $objectStr($numRows);
     }
     return $numRows;
 }
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:8,代码来源:DatabaseSqlserver.php

示例5: numRecords

 public function numRecords()
 {
     if (!is_resource($this->handle)) {
         return false;
     }
     // WARNING: This will only work if the cursor type is scrollable!
     if (function_exists('sqlsrv_num_rows')) {
         return sqlsrv_num_rows($this->handle);
     } else {
         user_error('MSSQLQuery::numRecords() not supported in this version of sqlsrv', E_USER_WARNING);
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-mssql,代码行数:12,代码来源:SQLServerQuery.php

示例6: num_rows

 function num_rows()
 {
     $num_rows = 0;
     $out = "";
     if ($this->result != false) {
         $num_rows = sqlsrv_num_rows($this->result);
         $out = $num_rows;
     } else {
         $out = 0;
     }
     //END if
     return $out;
 }
开发者ID:sostrenegrene,项目名称:toolbox,代码行数:13,代码来源:mssql.class.php

示例7: fetchNRow

function fetchNRow($db, $query)
{
    global $db;
    $params = array();
    $options = array("Scrollable" => SQLSRV_CURSOR_KEYSET);
    $stmt = sqlsrv_query($db, $query, $params, $options);
    $row_count = sqlsrv_num_rows($stmt);
    if ($row_count === false) {
        die(print_r(sqlsrv_errors(), true));
    } else {
        return $row_count;
    }
    return false;
}
开发者ID:jangraravik,项目名称:scripts,代码行数:14,代码来源:api_driver_sql.php

示例8: _num_rows

 public function _num_rows()
 {
     switch ($this->type) {
         case 'mssql':
             return mssql_num_rows($this->result);
             break;
         case 'sqlsrv':
             return sqlsrv_num_rows($this->result);
             break;
         default:
         case 'mysql':
             return mysql_num_rows($this->result);
             break;
     }
 }
开发者ID:apexad,项目名称:editsee,代码行数:15,代码来源:editsee_DatabaseResult.class.php

示例9: loginQuery

function loginQuery($user, $psw)
{
    global $serverName, $connectionInfo;
    $conn = sqlsrv_connect($serverName, $connectionInfo);
    $query = "Select TOP 1 * from usuario \n\tWHERE usuario='{$user}' OR correo='{$user}' AND contrasena='{$psw}'";
    $params = array();
    $options = array("Scrollable" => SQLSRV_CURSOR_KEYSET);
    $stmt = sqlsrv_query($conn, $query, $params, $options);
    $row_count = sqlsrv_num_rows($stmt);
    $row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC);
    if ($row_count === 1) {
        $keys = array('result' => "true", 'id' => $row['id'], 'nombre' => $row['nombre'], 'correo' => $row['correo'], 'usuario' => $row['usuario'], 'pass' => $row['contrasena'], 'puesto' => $row['puesto']);
        return $keys;
    }
    if ($stmt === false) {
        die(print_r(sqlsrv_errors(), true));
    }
    sqlsrv_close($conn);
}
开发者ID:ADBUPIICSA,项目名称:ABDWEB,代码行数:19,代码来源:db.php

示例10: query

 /**
  * (non-PHPdoc)
  *
  * @see Core_DB::query()
  */
 public function query($str, $key = '')
 {
     $this->query_str = $this->parse_prefix($str);
     // 自动替换表前缀
     if (!is_resource($this->link)) {
         $this->connect();
     }
     N('db_query', 1);
     // 记录开始执行时间
     G('queryStartTime');
     $this->lastqueryid = sqlsrv_query($this->link, $this->query_str, array(), array("Scrollable" => SQLSRV_CURSOR_KEYSET));
     $this->debug();
     if (false === $this->lastqueryid) {
         $this->error();
         return false;
     } else {
         $this->num_rows = sqlsrv_num_rows($this->lastqueryid);
         return $this->get_all($key);
     }
 }
开发者ID:hubs,项目名称:yuncms,代码行数:25,代码来源:Sqlsrv.php

示例11: query

 /**
  * 执行查询  返回数据集
  * @access public
  * @param string $str  sql指令
  * @param array $bind 参数绑定
  * @return mixed
  */
 public function query($str,$bind=array()) {
     $this->initConnect(false);
     if ( !$this->_linkID ) return false;
     //释放前次的查询结果
     if ( $this->queryID ) $this->free();
     N('db_query',1);
     // 记录开始执行时间
     G('queryStartTime');
     $str    =   str_replace(array_keys($bind),'?',$str);
     $bind   =   array_values($bind);
     $this->queryStr = $str;
     $this->queryID = sqlsrv_query($this->_linkID,$str,$bind, array( "Scrollable" => SQLSRV_CURSOR_KEYSET));
     $this->debug();
     if ( false === $this->queryID ) {
         $this->error();
         return false;
     } else {
         $this->numRows = sqlsrv_num_rows($this->queryID);
         return $this->getAll();
     }
 }
开发者ID:king192,项目名称:mycollects,代码行数:28,代码来源:Sqlsrv.class.php

示例12: storePlayer

function storePlayer($name, $email, $gcm_regid)
{
    $db = new BaseDB();
    // insert user into database
    $sql = "INSERT INTO gcm_users(name, email, gcm_regid, created_at) VALUES('{$name}', '{$email}', '{$gcm_regid}', GETDATE())";
    $result = $db->dbQuery($sql);
    // check for successful store
    if ($result) {
        // get user details
        $id = $db->getLastId('gcm_users');
        // last inserted id
        $result = $db->dbQuery("SELECT * FROM gcm_users WHERE id = {$id}") or die(dbGetErrorMsg());
        // return user details
        $NumRecords = sqlsrv_num_rows($result);
        if ($NumRecords > 0) {
            return sqlsrv_fetch_array($result, SQLSRV_FETCH_BOTH);
        } else {
            return false;
        }
    } else {
        return false;
    }
}
开发者ID:beingsane,项目名称:ClashOfClans-1,代码行数:23,代码来源:GCM_Functions.php

示例13: sql_num_rows

 function sql_num_rows($sqltype, $result)
 {
     if ($sqltype == 'mysql') {
         if (class_exists('mysqli_result')) {
             return $result->mysqli_num_rows;
         } elseif (function_exists('mysql_num_rows')) {
             return mysql_num_rows($result);
         }
     } elseif ($sqltype == 'mssql') {
         if (function_exists('sqlsrv_num_rows')) {
             return sqlsrv_num_rows($result);
         } elseif (function_exists('mssql_num_rows')) {
             return mssql_num_rows($result);
         }
     } elseif ($sqltype == 'pgsql') {
         return pg_num_rows($result);
     } elseif ($sqltype == 'oracle') {
         return oci_num_rows($result);
     } elseif ($sqltype == 'sqlite3') {
         $metadata = $result->fetchArray();
         if (is_array($metadata)) {
             return $metadata['count'];
         }
     } elseif ($sqltype == 'sqlite') {
         return sqlite_num_rows($result);
     } elseif ($sqltype == 'odbc') {
         return odbc_num_rows($result);
     } elseif ($sqltype == 'pdo') {
         return $result->rowCount();
     }
 }
开发者ID:retanoj,项目名称:webshellSample,代码行数:31,代码来源:7394316867fbf40088309b5150e77721.php

示例14: numRows

 /**
  * Return the number of rows in the result.
  *
  * @throws \Pop\Db\Adapter\Exception
  * @return int
  */
 public function numRows()
 {
     if (isset($this->statement)) {
         return sqlsrv_num_rows($this->statement);
     } else {
         if (isset($this->result)) {
             return sqlsrv_num_rows($this->result);
         } else {
             throw new Exception('Error: The database result resource is not currently set.');
         }
     }
 }
开发者ID:akinyeleolubodun,项目名称:PhireCMS2,代码行数:18,代码来源:Sqlsrv.php

示例15: sqlsrv_query

?>
 </h3><!---หัวเรื่องหลัก-->
           <p>&nbsp;</p><!---หัวเรื่องรอง-->
		  <!----<input type="button" value="-จ่ายของเข้ารถ" id="btn" onclick="window.location='?page=add_picking_head';" class="inner_position_right" >
			---->
	</div><div class="sep"></div><br>
<form method="post" action="" id="frmSearch" name="frmSearch">
<table cellpadding="0" cellspacing="0"  border="0" align="center"  >
<tr><td colspan="2" align="center">
	<b>คลัง : </b>
	<select id="txt_location" name="txt_location"  style="width:170px;" required/>
	<option value="" > - เลือกคลังสินค้า - </option>
	<?php 
$sqlLoc = "select * from st_warehouse_location ";
$qryLoc = sqlsrv_query($con, $sqlLoc);
$row = sqlsrv_num_rows($qryLoc);
while ($detail = sqlsrv_fetch_array($qryLoc)) {
    ?>
			<option value="<?php 
    print $detail['locationno'];
    ?>
" ><?php 
    print $detail['locationname'];
    ?>
</option>
		
			<?php 
}
?>
	</select>
	<b>จ่ายให้</b>
开发者ID:CarabaoTawandang,项目名称:saleapp-web-test,代码行数:31,代码来源:from_picking_headAdmin.php


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