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


PHP mysql_field_seek函数代码示例

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


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

示例1: hasierara

 function hasierara()
 {
     if (mysql_field_seek($this->query, 0)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:aanabit,项目名称:reactquiz,代码行数:8,代码来源:dbo_lib.php

示例2: list_fields

 /**
  * Fetch Field Names
  *
  * Generates an array of column names
  *
  * @return	array
  */
 public function list_fields()
 {
     $field_names = array();
     mysql_field_seek($this->result_id, 0);
     while ($field = mysql_fetch_field($this->result_id)) {
         $field_names[] = $field->name;
     }
     return $field_names;
 }
开发者ID:marketcoinfork,项目名称:BitWasp-Fork,代码行数:16,代码来源:mysql_result.php

示例3: getupdatesql

 static function getupdatesql(&$rs, $data, $InsertIfNoResult = false, $insertData = null, $ignore = false)
 {
     $db = kernel::database();
     if (!is_resource($rs['rs'])) {
         trigger_error('GetUpdateSQL: ' . $rs['sql'] . ' error ', E_USER_ERROR);
     }
     @mysql_data_seek($rs['rs'], 0);
     $row = mysql_fetch_assoc($rs['rs']);
     if ($InsertIfNoResult && !$row) {
         return self::getinsertsql($rs, $data);
     }
     if (preg_match('/FROM\\s+([]0-9a-z_:"`.@[-]*)/is', $rs['sql'], $tableName)) {
         $tableName = $tableName[1];
     }
     if (is_object($data)) {
         $data = get_object_vars($data);
     }
     foreach ($data as $key => $value) {
         $data[strtolower($key)] = $value;
     }
     $UpdateValues = array();
     $col_count = mysql_num_fields($rs['rs']);
     for ($i = 0; $i < $col_count; $i++) {
         $column = mysql_fetch_field($rs['rs'], $i);
         if (array_key_exists($column->name, $data) && ($ignore || $data[$column->name] !== $row[$column->name] || $column->type == 'bool')) {
             if (is_array($data[$column->name]) || is_object($data[$column->name])) {
                 if (serialize($data[$column->name]) == $row[$column->name]) {
                     continue;
                 }
             }
             $UpdateValues[] = '`' . $column->name . '`=' . self::quotevalue($db, $data[$column->name], $column->type);
         }
     }
     mysql_field_seek($rs['rs'], 0);
     if (count($UpdateValues) > 0) {
         $whereClause = base_db_tools::db_whereClause($rs['sql']);
         $UpdateValues = implode(',', $UpdateValues);
         $sql = 'UPDATE ' . $tableName . ' SET ' . $UpdateValues;
         if (strlen($whereClause) > 0) {
             $sql .= ' WHERE ' . $whereClause;
         }
         return $sql;
     } else {
         return '';
     }
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:46,代码来源:tools.php

示例4: db_get_insert_sql

function db_get_insert_sql($db, &$rs, &$data, $autoup = false)
{
    if (!$rs['rs']) {
        trigger_error('GetInsertSQL: ' . $rs['sql'] . ' error ', E_USER_WARNING);
        return false;
    }
    mysql_field_seek($rs['rs'], 0);
    if (is_object($data)) {
        $data = get_object_vars($data);
    }
    foreach ($data as $key => $value) {
        $data[strtolower($key)] = $value;
    }
    if (preg_match('/FROM\\s+([]0-9a-z_:"`.@[-]*)/is', $rs['sql'], $tableName)) {
        $tableName = $tableName[1];
    }
    if ($autoup) {
        $keyColumn = mysql_fetch_field($rs['rs']);
        if (!$data[strtolower($keyColumn->name)]) {
            $rs = $db->exec('SELECT MAX(' . $keyColumn->name . ') AS keyid FROM ' . $tableName);
            $result = $db->selectrow('SELECT MAX(' . $keyColumn->name . ') AS keyid FROM ' . $tableName);
            $data[$keyColumn->name] = $result['keyid'] + 1;
        }
    }
    $insertValues = array();
    $col_count = mysql_num_fields($rs['rs']);
    for ($i = 0; $i < $col_count; $i++) {
        $column = mysql_fetch_field($rs['rs'], $i);
        if (isset($data[$column->name])) {
            $insertValues[$column->name] = db_quotevalue($db, $data[$column->name], $column->type);
        }
    }
    $strValue = implode(',', $insertValues);
    $strFields = implode('`,`', array_keys($insertValues));
    mysql_field_seek($rs['rs'], 0);
    return 'INSERT INTO `' . $tableName . '` ( `' . $strFields . '` ) VALUES ( ' . $strValue . ' )';
}
开发者ID:noikiy,项目名称:MyShop,代码行数:37,代码来源:db.tools.php

示例5: field_seek

 function field_seek($result, $i)
 {
     return mysql_field_seek($result, $i);
 }
开发者ID:name256,项目名称:crm42,代码行数:4,代码来源:database.inc.php

示例6: printf

<?php

include "connect.inc";
$tmp = NULL;
$link = NULL;
if (!is_null($tmp = @mysql_field_seek())) {
    printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
if (!is_null($tmp = @mysql_field_seek($link))) {
    printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
require 'table.inc';
if (!($res = mysql_query("SELECT id, label FROM test ORDER BY id LIMIT 1", $link))) {
    printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link));
}
var_dump(mysql_field_seek($res, -1));
var_dump(mysql_fetch_field($res));
var_dump(mysql_field_seek($res, 0));
var_dump(mysql_fetch_field($res));
var_dump(mysql_field_seek($res, 1));
var_dump(mysql_fetch_field($res));
var_dump(mysql_field_seek($res, 2));
var_dump(mysql_fetch_field($res));
mysql_free_result($res);
var_dump(mysql_field_seek($res, 0));
mysql_close($link);
print "done!";
error_reporting(0);
require_once "clean_table.inc";
开发者ID:badlamer,项目名称:hhvm,代码行数:29,代码来源:mysql_field_seek.php

示例7: fieldSeek

 function fieldSeek($fieldOffset)
 {
     /* 将结果集中的指针设定为制定的字段偏移量 */
     return mysql_field_seek($this->Result, $fieldOffset);
 }
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:5,代码来源:db.php

示例8: __construct

 function __construct($server, $user, $pw, $db, $table, $options = null)
 {
     if (!isset($_REQUEST["op"])) {
         return;
     }
     if ($options) {
         if (isset($options["add_allowed"])) {
             $this->add_allowed = $options["add_allowed"];
         }
         if (isset($options["delete_allowed"])) {
             $this->delete_allowed = $options["delete_allowed"];
         }
         if (isset($options["editablecols"])) {
             $this->editablecols = $options["editablecols"];
         }
         if (isset($options["defaultcols"])) {
             $this->defaultcols = $options["defaultcols"];
         }
         if (isset($options["sortcol"])) {
             $this->sortcol = $options["sortcol"];
         }
         if (isset($options["sort"])) {
             $this->sort = $options["sort"];
         }
         if (isset($options["SQLCharset"])) {
             $this->SQLCharset = $options["SQLCharset"];
         }
         if (isset($options["HTMLCharset"])) {
             $this->HTMLCharset = $options["HTMLCharset"];
         }
     }
     /* Optionally retrieve parameters from the addparams parameter.
      * Uncomment the line below and change "myparameter" to the name of your parameter
      * If you pass multiple parameters copy the line multiple times
      * 
      * $myparameter = $_REQUEST["myparameter"];
      */
     $this->conn = mysql_connect($server, $user, $pw) or die(mysql_error());
     mysql_select_db($db) or die(mysql_error());
     $this->table = $table;
     $res = mysql_query("SET NAMES '" . $this->SQLCharset . "'", $this->conn);
     // Initialize the name of the id field, column names and numeric columns:
     $idresult = $this->metadata();
     $primary_found = false;
     for ($i = 0; $i < mysql_num_fields($idresult); $i++) {
         $fld = mysql_fetch_field($idresult, $i);
         if ($primary_found == false) {
             if ($fld->primary_key == 1) {
                 $this->idname = $fld->name;
                 $this->idcolnr = $i;
                 $primary_found = true;
             } elseif ($fld->unique_key == 1) {
                 $this->idname = $fld->name;
                 $this->idcolnr = $i;
             }
         }
         $this->cols[] = $fld->name;
         if ($fld->numeric == 1) {
             $this->cols_numeric[] = $fld->name;
         }
     }
     if (!isset($this->idname)) {
         die("Could not find primary or unique key");
     }
     // Initialize editablecols if not done yet:
     if (!isset($this->editablecols)) {
         mysql_field_seek($idresult, 0);
         for ($i = 0; $i < mysql_num_fields($idresult); $i++) {
             $fldname = mysql_fetch_field($idresult)->name;
             if ($fldname != $this->idname) {
                 $this->editablecols[] = $fldname;
             }
         }
     }
     mysql_free_result($idresult);
     // Initialize Field types:
     $this->fldtypes = array();
     $colresult = mysql_query("SHOW COLUMNS FROM " . $this->table, $this->conn) or die(mysql_error());
     for ($i = 0; $i < mysql_num_rows($colresult); $i++) {
         list($fldname, $fldtype, $fldnull, $fldkey, $flddefault, $fldextra) = mysql_fetch_row($colresult);
         $this->fldtypes[$fldname] = $fldtype;
     }
     mysql_free_result($colresult);
     // Calculate the WHERE string and the string for the ADD operation, if the defaultcols option is set.
     $this->wherestr = "";
     $this->addstr = " () VALUES () ";
     if ($this->defaultcols) {
         foreach ($this->defaultcols as $key => $value) {
             $assignment[] = $key . " = '" . $value . "'";
         }
         $wherestr1 = implode(" AND ", $assignment);
         $this->wherestr = sprintf(" WHERE %s ", $wherestr1);
         $addstr1 = implode(", ", array_keys($this->defaultcols));
         $addstr2 = implode(", ", array_map(array($this, "addquotes"), array_values($this->defaultcols)));
         $this->addstr = sprintf(" (%s) VALUES (%s) ", $addstr1, $addstr2);
     }
     // Do the sorting:
     if (isset($_REQUEST["sortcol"])) {
         $this->sortcol = mysql_real_escape_string($_REQUEST["sortcol"]);
     }
//.........这里部分代码省略.........
开发者ID:FaddliLWibowo,项目名称:GIS,代码行数:101,代码来源:drasticSrcMySQL.class.php

示例9: field_seek

 public function field_seek(&$result, $offset)
 {
     if (!is_resource($result)) {
         return false;
     }
     return @mysql_field_seek($result, $offset);
 }
开发者ID:GamerSource,项目名称:Infected-CMS-2,代码行数:7,代码来源:_database.class.php

示例10: FieldTable

	function FieldTable($resultado, $deslocamento_do_campo){
		$this->resultado    = $resultado;
	    $this->deslocamento = $deslocamento_do_campo;
		return @mysql_field_seek($this->resultado, $this->deslocamento);
	}
开发者ID:nowakis,项目名称:TesteNet,代码行数:5,代码来源:class.dbMySQL.php

示例11: mysql_fetch_field

}
$obj_seek = mysql_fetch_field($res);
if (!is_object($obj_seek)) {
    printf("FAILURE: expecting object (seek), got %s value, [%d] %s\n", gettype($obj_seek), mysql_errno($con), mysql_error($con));
}
if ($obj_seek->name != 'msg') {
    printf("FAILURE: expecting name to be 'msg', got value %s, [%d] %s\n", $obj_seek->name, mysql_errno($con), mysql_error($con));
}
$obj_direct = mysql_fetch_field($res, 1);
if (!is_object($obj_direct)) {
    printf("FAILURE: expecting object (direct), got %s value, [%d] %s\n", gettype($obj_direct), mysql_errno($con), mysql_error($con));
}
if ($obj_seek != $obj_direct) {
    printf("FAILURE: objects should be identical,  [%d] %s\n", mysql_errno($con), mysql_error($con));
}
$ret = mysql_field_seek($res, 99);
if (!is_bool($ret)) {
    printf("FAILURE: expecting boolean value, got %s value, [%d] %s\n", gettype($ret), mysql_errno($con), mysql_error($con));
}
if ($ret) {
    printf("FAILURE: expecting false, [%d] %s\n", mysql_errno($con), mysql_error($con));
}
mysql_free_result($res);
mysql_close($con);
?>
--EXPECT-EXT/MYSQL-OUTPUT--
SUCCESS: connect

--EXPECT-EXT/MYSQL-PHP-ERRORS--
--EXPECT-EXT/MYSQLI-OUTPUT--
SUCCESS: connect
开发者ID:josenobile,项目名称:MySQLConverterTool,代码行数:31,代码来源:generic006.php

示例12: db_field_seek

function db_field_seek($result, $fldnum)
{
    return mysql_field_seek($result, $fldnum);
}
开发者ID:kktsvetkov,项目名称:1double.com,代码行数:4,代码来源:db_body.inc.php

示例13: seek

 function seek($p_rs, $p_num)
 {
     return mysql_field_seek($p_rs, $p_num);
 }
开发者ID:Nightchen0521,项目名称:cmf,代码行数:4,代码来源:db.class.php

示例14: display_table

    /**
     * Displays a table of results returned by a sql query
     *
     * @param   array   the result table to display
     * @param   mixed   whether to display navigation bar and bookmarks links
     *                  or not
     *
     * @global  string   the current language
     * @global  integer  the server to use (refers to the number in the
     *                   configuration file)
     * @global  string   the database name
     * @global  string   the table name
     * @global  string   the current sql query
     * @global  string   the url to go back in case of errors
     * @global  integer  the total number of rows returned by the sql query
     * @global  boolean  whether to limit the number of displayed charcaters of
     *                   text type fields or not
     */
    function display_table($dt_result, $is_simple = FALSE)
    {
        global $lang, $server, $db, $table;
        global $sql_query, $goto, $pos;
        global $SelectNumRows, $dontlimitchars;
        // Gets the number of rows per page
        if (isset($GLOBALS['sessionMaxRows'])) {
            $GLOBALS['cfgMaxRows'] = $GLOBALS['sessionMaxRows'];
        } else {
            $GLOBALS['sessionMaxRows'] = $GLOBALS['cfgMaxRows'];
        }
        // Loads a javascript library that does quick validations
        ?>

        <?php 
        echo "\n";
        // Counts the number of rows in the table if required
        if (isset($SelectNumRows) && $SelectNumRows != '') {
            $total = $SelectNumRows;
        } else {
            if (!$is_simple && !empty($table) && !empty($db)) {
                $local_query = 'SELECT COUNT(*) as total FROM ' . backquote($db) . '.' . backquote($table);
                $result = mysql_query($local_query) or mysql_die('', $local_query);
                $row = mysql_fetch_array($result);
                $total = $row['total'];
            }
        }
        // end if
        // Defines offsets for the next and previous pages
        if (!$is_simple) {
            if (!isset($pos)) {
                $pos = 0;
            }
            $pos_next = $pos + $GLOBALS['cfgMaxRows'];
            $pos_prev = $pos - $GLOBALS['cfgMaxRows'];
            if ($pos_prev < 0) {
                $pos_prev = 0;
            }
        }
        // end if
        // Displays a messages with position informations
        if (isset($total) && $total > 1 && isset($pos_next)) {
            if (isset($SelectNumRows) && $SelectNumRows != $total) {
                $selectstring = ', ' . $SelectNumRows . ' ' . $GLOBALS['strSelectNumRows'];
            } else {
                $selectstring = '';
            }
            $lastShownRec = $total < $pos_next ? $total : $pos_next;
            show_message($GLOBALS['strShowingRecords'] . " {$pos} - {$lastShownRec} ({$total} " . $GLOBALS['strTotal'] . $selectstring . ')');
        } else {
            show_message($GLOBALS['strSQLQuery']);
        }
        // Displays the navigation bars
        $field = mysql_fetch_field($dt_result);
        if (!isset($table) || strlen(trim($table)) == 0) {
            $table = $field->table;
        }
        mysql_field_seek($dt_result, 0);
        if (!$is_simple && (!isset($SelectNumRows) || 1 < $SelectNumRows)) {
            show_table_navigation($pos_next, $pos_prev, $dt_result);
        } else {
            echo "\n";
            echo "<!-- End of table navigation bar -->";
            echo '<script type="text/javascript" language="javascript">';
            echo "<!--";
            echo "var errorMsg1 = " . str_replace("\\'", "\\\\'", $GLOBALS["strNotNumber"]) . ";";
            echo "var errorMsg2 = " . str_replace('\'', '\\\'', $GLOBALS["strNotValidNumber"]) . ";";
            echo "//-->";
            echo "</script>";
            echo '<script src="functions.js" type="text/javascript" language="javascript"></script>';
            echo '<br><br>' . "\n";
        }
        // Displays the results
        $is_show_processlist = eregi("^[ \n\r]*show[ \n\r]*processlist[ \n\r]*\$", $sql_query);
        ?>

<table border="<?php 
        echo $GLOBALS['cfgBorder'];
        ?>
" cellpadding="5">
<tr>
        <?php 
//.........这里部分代码省略.........
开发者ID:CMMCO,项目名称:Intranet,代码行数:101,代码来源:lib.inc.php

示例15: printf

<?php

require_once 'connect.inc';
if (!($link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))) {
    printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket);
}
mysql_select_db($db, $link);
mysql_query("DROP TABLE IF EXISTS test_47438", $link);
mysql_query("CREATE TABLE test_47438 (a INT, b INT, c INT)", $link);
mysql_query("INSERT INTO test_47438 VALUES (10, 11, 12), (20, 21, 22)", $link);
$result = mysql_query("SELECT * FROM test_47438", $link);
mysql_field_seek($result, 1);
$i = 0;
while ($i < mysql_num_fields($result)) {
    $meta = mysql_fetch_field($result, $i);
    echo $i . "." . $meta->name . "\n";
    $i++;
}
mysql_query("DROP TABLE IF EXISTS test_47438", $link);
error_reporting(0);
require_once 'connect.inc';
if (!($link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))) {
    printf("[c001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket);
}
if (!mysql_select_db($db, $link) || !mysql_query("DROP TABLE IF EXISTS test_47438", $link)) {
    printf("[c002] [%d] %s\n", mysql_errno($link), mysql_error($link));
}
mysql_close($link);
开发者ID:badlamer,项目名称:hhvm,代码行数:28,代码来源:bug47438.php


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