本文整理汇总了PHP中mssql_num_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP mssql_num_rows函数的具体用法?PHP mssql_num_rows怎么用?PHP mssql_num_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mssql_num_rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
public function query($sql, $start = null, $perpage = null, $nolimit = false)
{
$start and !$perpage and $perpage = 10000;
$query = mssql_query($sql, $this->dbConnection());
if ($start) {
$qcount = mssql_num_rows($query);
if ($qcount < $start) {
return array();
} else {
mssql_data_seek($query, $start);
}
}
if ($query) {
$result = array();
while ($row = mssql_fetch_assoc($query)) {
if (DBCHARSET == 'gbk' && CHARSET != 'gbk') {
$row = Base_Class::gbktoutf($row);
}
$result[] = $row;
if ($perpage && count($result) >= $perpage) {
break;
}
}
return $result;
} else {
$this->halt("数据库查询错误", $sql);
}
}
示例2: executeQuery
private function executeQuery()
{
$return = false;
if ($this->queryType == 'other') {
if (mssql_query($this->query, $this->link) === true) {
$return = true;
$this->error = mssql_get_last_message();
}
} else {
if ($result = mssql_query($this->query, $this->link)) {
// Conteo de registros
if ($this->queryType == 'insert' || $this->queryType == 'update' || $this->queryType == 'delete') {
$this->numRows = mssql_rows_affected($this->link);
$return = true;
} else {
$this->numRows = mssql_num_rows($result);
$fetchType = MSSQL_NUM;
if ($this->queryReturn == 'assoc') {
$fetchType = MSSQL_ASSOC;
} elseif ($this->queryReturn == 'both') {
$fetchType = MSSQL_BOTH;
}
$return = array();
while ($row = mssql_fetch_array($result, $fetchType)) {
array_push($return, $row);
}
}
$this->error = mssql_get_last_message();
mssql_free_result($result);
} else {
$this->error = mssql_get_last_message();
}
}
return $return;
}
示例3: query
/**
* @param $sql
*
* @return array
*/
public function query($sql)
{
//
$this->connection = $this->getConnection();
// Run query
$query = mssql_query($sql, $this->connection);
// On error
if ($query === false) {
Response::error(500, $_SERVER["SERVER_PROTOCOL"] . ' DB query failed (SQL): ' . mssql_get_last_message());
}
// E.g. boolean is returned if no rows (e.g. no resource found or on UPDATE)
if ($query === true) {
$response = $query;
} else {
// Response
$response = array();
//
// Loop rows and add to response array
if (mssql_num_rows($query) > 0) {
while ($row = mssql_fetch_assoc($query)) {
$response[] = $row;
}
}
// Free the query result
mssql_free_result($query);
}
// Close link
$this->closeConnection();
//
return $response;
}
示例4: __construct
public function __construct($account)
{
try {
global $ldMssql;
$this->clearVars();
$checkVault = $ldMssql->query("SELECT [DbVersion] FROM [" . DATABASE_ACCOUNTS . "].[dbo].[warehouse] WHERE [AccountId] = '" . $account . "'");
if (mssql_num_rows($checkVault) == 0) {
throw new Exception("<script> alert('Essa conta não possui baú.'); location = '?page=paneluser'; </script>");
}
$dbVersion = mssql_fetch_object($checkVault);
if (is_numeric($dbVersion->DbVersion) == false) {
throw new Exception("Vault class error: dbVersion must be numeric.");
}
if ($dbVersion < 1 || $dbVersion->DbVersion > 3) {
throw new Exception("Vault class error: dbVersion invalid.");
}
$this->dbVersion = $dbVersion->DbVersion;
$this->account = $account;
if ($this->dbVersion == 3) {
$getLenghts = $ldMssql->query("USE [" . DATABASE_ACCOUNTS . "]; SELECT [length] FROM [syscolumns] WHERE OBJECT_NAME([id]) = 'warehouse' AND [name] = 'Items'; USE [" . DATABASE . "];");
$getLenghts = mssql_fetch_object($getLenghts);
$this->slotNumbers = $getLenghts->length * 2 / 32;
}
} catch (Exception $msg) {
exit($msg->getMessage());
}
}
示例5: getRecord
/**
* mengambil record dari sebuah tabel dalam bentuk array
* @param sqlString ini sql string
* @param offset
*
*/
public function getRecord($sqlString, $offset = 1)
{
// echo $sqlString;
if (mssql_num_rows($result = $this->query($sqlString)) >= 1) {
if ($offset == '') {
$offset = 1;
}
$ft = $this->getFieldTable("field");
// print_r($ft);
$countFieldTable = count($ft);
$counter = 1;
while ($row = mssql_fetch_array($result)) {
//echo $row . "<br>";
$tempRecord['no'] = $offset;
for ($i = 0; $i < $countFieldTable; $i++) {
$tempRecord[$ft[$i]] = trim($row[$ft[$i]]);
}
$ListRecord[$counter] = $tempRecord;
$counter++;
$offset++;
}
// print_r($ListRecord);
$this->ListRecord = $ListRecord;
} else {
$this->ListRecord = array();
}
return $this->ListRecord;
}
示例6: dbquery_func_old
function dbquery_func_old($connection_info, $query, $debug = "off")
{
if ($connection_info['db_type'] == "mysql") {
mysql_connect($connection_info['db_host'] . ":" . $connection_info['db_port'], $connection_info['username'], $connection_info['password']) or die("Unable to connect to " . $connection_info['db_host']);
mysql_select_db($connection_info['db_name']) or die("Unable to select database " . $connection_info['db_name']);
$return = mysql_query($query);
if ($debug == "on") {
$merror = mysql_error();
if (!empty($merror)) {
print "MySQL Error:<br />" . $merror . "<p />Query<br />: " . $query . "<br />";
}
print "Number of rows returned: " . mysql_num_rows($return) . "<br />";
}
} else {
if ($connection_info['db_type'] == "mssql") {
mssql_connect($connection_info['db_host'] . "," . $connection_info['db_port'], $connection_info['username'], $connection_info['password']) or die("Unable to connect to " . $connection_info['db_host'] . "<br />" . $query);
mssql_select_db($connection_info['db_name']) or die("Unable to select database " . $connection_info['db_name']);
$return = mssql_query($query);
if ($debug == "on") {
$merror = mssql_get_last_message();
if (!empty($merror)) {
print "MySQL Error: " . $merror . "<br />Query" . $query . "<br />";
}
print "Number of rows returned: " . mssql_num_rows($result) . "<br />";
}
}
}
return $return;
}
示例7: __construct
public function __construct($BuyID, $searchItem = false)
{
global $LD_Items;
$this->searchItem = $searchItem;
$SQL_Q = $this->query("SELECT ConnectStat, DATEDIFF(MI, DisConnectTM, getdate()) DisConnectTM FROM MEMB_STAT WHERE memb___id='" . $_SESSION['Login'] . "'");
if (mssql_num_rows($SQL_Q) == 0) {
exit("<ul><li>Você deve entrar no jogo ao menos uma vez para efetuar esta ação!</li></ul>");
}
$SQL = mssql_fetch_object($SQL_Q);
if ($SQL->ConnectStat != 0) {
exit("<ul><li>Você deve estar offline do jogo para efetuar esta ação!</li></ul>");
}
$this->BuyID = $BuyID;
$this->VerifyBuy();
$this->FindItem();
if ($this->searchItem == true) {
exit;
}
if ((int) RECOVERY_LIMIT_ITEM > 0 && $this->recovery >= (int) RECOVERY_LIMIT_ITEM) {
exit(Print_error("<ul><li>Erro, excedido o número de vezes que o item ser recuperado (" . RECOVERY_LIMIT_ITEM . " vezes).</li></ul>"));
}
$this->Find_Details();
$LD_Items->Write_Variables($this->ProductID, $this->TP, $this->ID, $this->ProductSerial, $this->DUR, $this->X, $this->Y, $this->Item_Level, $this->Item_Option, $this->Item_Ancient, $this->Item_Skill, $this->Item_Luck, $this->Item_OpExc_1, $this->Item_OpExc_2, $this->Item_OpExc_3, $this->Item_OpExc_4, $this->Item_OpExc_5, $this->Item_OpExc_6, $this->Item_JH, $this->Item_Refine, $this->Item_Socket_Slot_1, $this->Item_Socket_Slot_2, $this->Item_Socket_Slot_3, $this->Item_Socket_Slot_4, $this->Item_Socket_Slot_5, $this->Item_Socket_Slot_1_Option, $this->Item_Socket_Slot_2_Option, $this->Item_Socket_Slot_3_Option, $this->Item_Socket_Slot_4_Option, $this->Item_Socket_Slot_5_Option);
$LD_Items->GenerateHex();
$LD_Items->GetVaultContent();
$LD_Items->CutSlotsVault();
$LD_Items->CutHexSlotsVault();
$LD_Items->RestructureSlotsFree();
$LD_Items->FindSlotsFree();
$this->WriteLog();
$LD_Items->WriteVault();
print "<ul><li>Seu item foi recuperado com sucesso! Obrigado.</li></ul>";
}
示例8: login
function login($email, $password)
{
/* query db and set session variables, as necessary */
$theQuery = "SELECT * FROM users WHERE email = '" . $email . "' AND userpassword = '" . $password . "'";
$theData = queryG0($theQuery);
if (!mssql_num_rows($theData)) {
echo 'No records found';
} else {
while ($row = mssql_fetch_array($query)) {
$thisEmail = $row['username'];
$thisPassword = $row['userpassword'];
$thisID = $row['id'];
$thisAccessLevel = $row['accesslevel'];
}
if ($email == $thisEmail && $password == $thisPassword) {
createSessionVariables($thisID, $thisAccessLevel);
/* Redirect to admin landing page */
header("Location: " . $GLOBALS['adminLandingPage']);
} else {
clearSessionVariables();
/* Redirect to login with error msg */
header("Location: " . $GLOBALS['loginWithError']);
}
}
}
示例9: xcopy
function xcopy($mssql, $mysql, $db, $table, $sql)
{
$start = microtime(true);
mysqli_select_db($mysql, $db);
mssql_select_db($db, $mssql);
$result = mssql_query($sql, $mssql, 20000);
if ($result === false) {
die("Error creating sync data\n");
}
$s = 0;
$r = mssql_num_rows($result);
$name_count = mssql_num_fields($result);
$name_list = "";
$update_list = "";
$value_list = "";
$sql = "";
$radix = 0;
for ($i = 0; $i < $name_count; $i++) {
$x = strtolower(mssql_field_name($result, $i));
$name_list .= "{$x},";
if ($x != "dex_row_id") {
$update_list .= "{$x} = values({$x}),";
}
}
$name_list = rtrim($name_list, ",");
$update_list = rtrim($update_list, ",");
do {
while ($row = mssql_fetch_row($result)) {
for ($i = 0; $i < $name_count; $i++) {
$value_list .= "'" . str_replace("'", "''", trim($row[$i])) . "',";
}
$value_list = rtrim($value_list, ",");
$radix++;
$sql .= "\n({$value_list}),";
$value_list = "";
if ($radix > 2000) {
$sql = trim($sql, ",");
$sql = "insert into {$table} ({$name_list}) values {$sql} on duplicate key update {$update_list};";
$rset = mysqli_query($mysql, $sql);
if ($rset === false) {
die("Error inserting mysql data. \n" . mysqli_error($mysql) . "\n\n{$sql}\n\n");
}
$radix = 0;
$sql = "";
}
$s++;
}
} while (mssql_fetch_batch($result));
if ($sql != "") {
$sql = trim($sql, ",");
$sql = "insert into {$table} ({$name_list}) values {$sql} on duplicate key update {$update_list};";
$rset = mysqli_query($mysql, $sql);
if ($rset === false) {
die("Error inserting mysql data. \n" . mysqli_error($mysql) . "\n\n{$sql}\n\n");
}
}
$end = microtime(true);
$total = $end - $start;
echo "imported {$db}.{$table} [ {$s} ] records in {$total} sec.\n";
}
示例10: queryContainsNewUsers
private function queryContainsNewUsers($query)
{
if ($query == false) {
return false;
}
return mssql_num_rows($query) > 0 ? true : false;
}
示例11: findFlights
function findFlights($flight)
{
//Connects to database
require 'connect_db.php';
$query = mssql_query('SELECT * FROM FLIGHT');
if (!mssql_num_rows($query)) {
echo 'No records found';
} else {
//Creates tables and fills it with flight numbers and their delays
echo '<br><br><br><br><table border = 1>';
echo '<th>Flight Number</th><th>Delayed</th><th>Depature Time</th>';
while ($row = mssql_fetch_assoc($query)) {
$i = 0;
//Check if flight is what is looking for
if (strcmp($row['Flight_number'], $flight) == 0) {
$i = $i + 1;
echo '<tr><td>' . $row['Flight_number'] . '</td>';
if (strcmp($row['Delayed'], '1') != 0) {
echo '<td>' . 'On Time' . '</td>';
} else {
echo '<td>' . 'Delayed' . '</td>';
}
echo '<td>' . $row['Depature_time'] . '</td></tr>';
//^End else
}
}
//^ends while
echo '</table>';
}
}
示例12: count
function count()
{
// Attention! See notes above.
if ($this->rs === true) {
return 0;
}
return mssql_num_rows($this->rs);
}
示例13: numRows
function numRows($r = 0)
{
if (!$r) {
$r = $this->lastResult;
}
$cnt = mssql_num_rows($r);
return $cnt;
}
示例14: num_rows
public static function num_rows($queryDB = '', $objectStr = '')
{
$numRows = mssql_num_rows($queryDB);
if (is_object($objectStr)) {
$objectStr($numRows);
}
return $numRows;
}
示例15: loginCookies
public function loginCookies($id, $hash)
{
$queryCookies = "SELECT id, hash FROM [user] WHERE id={$id} AND hash='{$hash}'";
if (mssql_num_rows(mssql_query($queryCookies)) == 1) {
$userEntry = mssql_fetch_array(mssql_query($queryCookies));
setcookie("id", $userEntry['id'], time() + 60 * 60 * 24, "/");
setcookie("hash", $userEntry['hash'], time() + 60 * 60 * 24, "/");
return true;
}
}