本文整理汇总了PHP中mssql_fetch_row函数的典型用法代码示例。如果您正苦于以下问题:PHP mssql_fetch_row函数的具体用法?PHP mssql_fetch_row怎么用?PHP mssql_fetch_row使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mssql_fetch_row函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: select_to_table
function select_to_table($query)
{
$results = mssql_query($query) or die("<li>errorno=" . mysql_errno() . "<li>error=" . mysql_error() . "<li>query=" . $query);
$number_cols = mssql_num_fields($results);
//display query
echo "<b>query: {$query}</b>";
//layout table header
echo "<table border = 1>\n";
echo "<tr align left>\n";
for ($i = 0; $i < $number_cols; $i++) {
echo "<th>" . mssql_field_name($results, $i) . "</th>\n";
}
echo "</tr>\n";
//end table header
//layout table body
while ($row = mssql_fetch_row($results)) {
echo "<tr align left>\n";
for ($i = 0; $i < $number_cols; $i++) {
echo "<td>";
if (!isset($row[$i])) {
echo "NULL";
} else {
echo $row[$i];
}
echo "</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
}
示例2: get_web_log
public function get_web_log()
{
//select the database
mssql_select_db($this->dbname, $this->dbcon);
//SQL Select statement
$xml = new XMLHandler(XML_DIR . "web_request_spk.xml");
$sql_from_xml = $xml->getNode("web_log");
$sqlselect = str_replace("FILTER_BY_PROGRAM", "", $sql_from_xml);
//Run the SQL query
$result = mssql_query($sqlselect);
$numfields = mssql_num_fields($result);
$string_result = "";
while ($row = mssql_fetch_row($result)) {
$string_result .= "<tr>";
for ($i = 0; $i < $numfields; $i++) {
if (mssql_field_name($result, $i) == "IP_ADDRESS") {
$ip = explode(":", $row[$i]);
$string_result .= "<td>" . $ip[0] . "</td>";
$string_result .= "<td>" . $ip[1] . "</td>";
} else {
$string_result .= "<td>" . $row[$i] . "</td>";
}
}
$string_result .= "</tr>";
}
return $string_result;
}
示例3: 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";
}
示例4: GetMembname
public function GetMembname()
{
global $tpl;
$SQL_Q = $this->query("SELECT memb_name FROM MEMB_INFO WHERE memb___id = '" . $_SESSION['Login'] . "'");
$SQL = mssql_fetch_row($SQL_Q);
$tpl->set("memb_name", (string) $SQL[0]);
}
示例5: GetDatabases
public function GetDatabases()
{
$collection = array();
$result = mssql_query("select name from sys.databases");
while ($row = mssql_fetch_row($result)) {
$collection[] = $row[0];
}
return $collection;
}
示例6: getOneColumnAsArray
function getOneColumnAsArray()
{
$column = array();
$queryId = $this->connection->execute($this->getSQL());
while (is_array($row = mssql_fetch_row($queryId))) {
$column[] = is_numeric($row[0]) ? $row[0] : mb_convert_encoding($row[0], 'UTF-8', 'Windows-1251');
}
mssql_free_result($queryId);
return $column;
}
示例7: getLastId
public function getLastId()
{
$last_id = false;
$resource = mssql_query("SELECT @@identity AS id", $this->link);
if ($row = mssql_fetch_row($resource)) {
$last_id = trim($row[0]);
}
mssql_free_result($resource);
return $last_id;
}
示例8: mssqlAdapter
/**
* Constructor method for the adapter. This constructor implements the setting of the
* 3 required properties for the object.
*
* @param resource $d The datasource resource
*/
function mssqlAdapter($d)
{
parent::RecordSetAdapter($d);
$fieldcount = mssql_num_fields($d);
// grab the number of fields
$ob = "";
$be = $this->isBigEndian;
$fc = pack('N', $fieldcount);
if (mssql_num_rows($d) > 0) {
mssql_data_seek($d, 0);
while ($line = mssql_fetch_row($d)) {
// write all of the array elements
$ob .= "\n" . $fc;
foreach ($line as $value) {
// write all of the array elements
if (is_string($value)) {
// type as string
$os = $this->_directCharsetHandler->transliterate($value);
//string flag, string length, and string
$len = strlen($os);
if ($len < 65536) {
$ob .= "" . pack('n', $len) . $os;
} else {
$ob .= "\f" . pack('N', $len) . $os;
}
} elseif (is_float($value) || is_int($value)) {
// type as double
$b = pack('d', $value);
// pack the bytes
if ($be) {
// if we are a big-endian processor
$r = strrev($b);
} else {
// add the bytes to the output
$r = $b;
}
$ob .= "" . $r;
} elseif (is_bool($value)) {
//type as bool
$ob .= "";
$ob .= pack('c', $value);
} elseif (is_null($value)) {
// null
$ob .= "";
}
}
}
}
$this->serializedData = $ob;
for ($i = 0; $i < $fieldcount; $i++) {
// loop over all of the fields
$this->columnNames[] = $this->_directCharsetHandler->transliterate(mssql_field_name($d, $i));
}
$this->numRows = mssql_num_rows($d);
}
示例9: loadTables
function loadTables()
{
if ($this->isExisting && !$this->isTablesLoaded) {
$queryId = $this->connection->execute("select TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_CATALOG='" . $this->name . "'");
while (is_array($row = mssql_fetch_row($queryId))) {
$this->tables[$row[0]] = null;
}
mssql_free_result($queryId);
$this->isTablesLoaded = true;
}
}
示例10: Valid_UserPwd
public function Valid_UserPwd()
{
if (empty($this->password) == true) {
exit(Print_error("Senha", 3));
}
$checkQ = $this->query('exec dbo.webVerifyLogin "' . $this->login . '","' . $this->password . '","' . HASHMD5 . '"');
$check = mssql_fetch_row($checkQ);
if ($check[0] == 0) {
exit(Print_error("Usuário ou Senha incorretos."));
}
}
示例11: lastInsertId
public function lastInsertId($name = '')
{
$sql = $name ? 'SELECT IDENT_CURRENT(' . $this->quote($name) . ')' : 'SELECT @@IDENTITY';
if ($result = mssql_query($sql, $this->link)) {
$row = mssql_fetch_row($result);
if ($row[0] === null) {
return -1;
}
return $row[0];
}
return false;
}
示例12: query
public static function query($queryStr = '', $objectStr = '')
{
$queryDB = mssql_query(self::$dbConnect, $queryStr);
if (preg_match('/insert into/i', $queryDB)) {
mssql_next_result($queryDB);
$row = mssql_fetch_row($queryDB);
self::$insertID = $row[0];
}
if (is_object($objectStr)) {
$objectStr($queryDB);
}
return $queryDB;
}
示例13: GetSerial
public function GetSerial()
{
if (defined("WZ_GETITEMSERIAL") == false) {
$SQL_Q = $this->query("exec WZ_GetItemSerial");
} else {
$SQL_Q = $this->query("exec " . constant("WZ_GETITEMSERIAL"));
}
$SQL = mssql_fetch_row($SQL_Q);
$Serial = strtoupper(dechex($SQL[0]));
$Serial = str_pad($Serial, 8, 0, STR_PAD_LEFT);
$this->Item_Serial = $Serial;
return $Serial;
}
示例14: charIDsByUsername
public static function charIDsByUsername($szUsername)
{
$result = array();
core::$sql->changeDB("shard");
$nJID = core::$sql->getRow("select JID from _AccountJID where AccountID='{$szUsername}'");
$hQuery = mssql_query("select CharID from _User where UserJID='{$nJID}'");
$i = 0;
while ($row = mssql_fetch_row($hQuery)) {
$result[$i] = $row[0];
$i++;
}
return $result;
}
示例15: _fetch_row
public function _fetch_row()
{
switch ($this->type) {
case 'mssql':
return mssql_fetch_row($this->result);
break;
case 'sqlsrv':
return sqlsrv_fetch_array($this->result, SQLSRV_FETCH_NUMERIC);
break;
default:
case 'mysql':
return mysql_fetch_row($this->result);
break;
}
}