本文整理汇总了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;
}
示例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);
}
示例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));
}
示例4: num_rows
public static function num_rows($queryDB = '', $objectStr = '')
{
$numRows = sqlsrv_num_rows($queryDB);
if (is_object($objectStr)) {
$objectStr($numRows);
}
return $numRows;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
}
示例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();
}
}
示例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;
}
}
示例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();
}
}
示例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.');
}
}
}
示例15: sqlsrv_query
?>
</h3><!---หัวเรื่องหลัก-->
<p> </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>