本文整理汇总了PHP中mysqli_field_seek函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_field_seek函数的具体用法?PHP mysqli_field_seek怎么用?PHP mysqli_field_seek使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysqli_field_seek函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mysql_field_seek
function mysql_field_seek($result, $field)
{
if (\Dshafik\MySQL::checkValidResult($result, __FUNCTION__)) {
// @codeCoverageIgnoreStart
return false;
// @codeCoverageIgnoreEnd
}
return mysqli_field_seek($result, $field);
}
示例2: var_dump
var_dump($tmp2);
}
if ($tmp1 != $fields['res'][$pos]) {
printf("[030] Field info differs, dumping data\n");
var_dump($tmp1);
var_dump($fields['res'][$pos]);
}
$pos++;
if ($pos !== ($tmp = mysqli_field_tell($res))) {
printf("[031] Expecting %s/%s got %s/%s\n", gettype($pos), $pos, gettype($tmp), $tmp);
}
if ($pos !== ($tmp = mysqli_field_tell($res_meta))) {
printf("[032] Expecting %s/%s got %s/%s\n", gettype($pos), $pos, gettype($tmp), $tmp);
}
} else {
if (false !== @mysqli_field_seek($res, $pos)) {
printf("[033] field_seek(%d) did not fail\n", $pos);
}
if (false !== @mysqli_field_seek($res_meta, $pos)) {
printf("[034] field_seek(%d) did not fail\n", $pos);
}
}
}
$res->free_result();
mysqli_free_result($res_meta);
var_dump(mysqli_fetch_field($res));
mysqli_stmt_close($stmt);
var_dump(mysqli_fetch_field($res));
mysqli_close($link);
var_dump(mysqli_fetch_field($res));
print "done!";
示例3: db_fieldname
function db_fieldname($lhandle, $fnumber) {
@mysqli_field_seek($lhandle, $fnumber);
$field = @mysqli_fetch_field($lhandle);
return $field ? $field->name : FALSE;
}
示例4: field_name
/**
* Devuelve el nombre de un campo en el resultado de un select
*
* @param int $number
* @param resource $result_query
* @return string
*/
public function field_name($number, $result_query = '')
{
if (!$this->id_connection) {
return false;
}
if (!$result_query) {
$result_query = $this->last_result_query;
if (!$result_query) {
return false;
}
}
if (($fieldName = mysqli_field_seek($result_query, $number)) !== false) {
$field = mysqli_fetch_field($result_query);
return $field->name;
} else {
throw new KumbiaException($this->error());
}
return false;
}
示例5: var_dump
var_dump(mysqli_field_seek($res, -1));
var_dump(mysqli_fetch_field($res));
var_dump(mysqli_field_seek($res, 0));
var_dump(mysqli_fetch_field($res));
var_dump(mysqli_field_seek($res, 1));
$field = mysqli_fetch_field($res);
var_dump($field);
/* label column, result set charset */
if ($field->charsetnr != $charsetInfo->number) {
printf("[004] Expecting charset %s/%d got %d\n", $charsetInfo->charset, $charsetInfo->number, $field->charsetnr);
}
if ($field->length != $charsetInfo->max_length) {
printf("[005] Expecting length %d got %d\n", $charsetInfo->max_length, $field->max_length);
}
var_dump(mysqli_field_tell($res));
var_dump(mysqli_field_seek($res, 2));
var_dump(mysqli_fetch_field($res));
var_dump(mysqli_field_seek($res, PHP_INT_MAX + 1));
mysqli_free_result($res);
if (!($res = mysqli_query($link, "SELECT NULL as _null", MYSQLI_STORE_RESULT))) {
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
var_dump(mysqli_field_seek($res, 0));
var_dump(mysqli_fetch_field($res));
mysqli_free_result($res);
var_dump(mysqli_field_seek($res, 0));
mysqli_close($link);
print "done!";
error_reporting(0);
$test_table_name = 'test_mysqli_field_seek_table_1';
require_once "clean_table.inc";
示例6: field_name
/**
* Get the name of the specified field in a result
* @param Mixed qHanle The query handle
* @param Number offset
* @return String
*/
public function field_name($qHanle, $offset)
{
@mysqli_field_seek($qHanle, $offset);
$field = @mysqli_fetch_field($qHanle);
return $field ? $field->name : "";
}
示例7: printf
printf("[009] Expecting object, got %s/%s, [%d] %s\n", gettype($field0_direct), $field0_direct, mysqli_errno($link), mysqli_error($link));
}
if ($field0_fetch != $field0_direct) {
printf("[010] mysqli_fetch_field() differs from mysqli_fetch_field_direct()\n");
var_dump($field0_fetch);
var_dump($field0_direct);
}
var_dump($field0_fetch);
if (!is_array($tmp = mysqli_fetch_fields($res))) {
printf("[011] Expecting array, got %s/%s, [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
}
if (empty($tmp[0]) || empty($tmp[1]) || $tmp[0] != $field0_direct) {
printf("[012] mysqli_fetch_fields() return value is suspicious\n");
var_dump($tmp);
}
if (!mysqli_field_seek($res, 1)) {
printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (!is_object($field1_direct = mysqli_fetch_field_direct($res, 1))) {
printf("[014] Expecting object, got %s/%s, [%d] %s\n", gettype($field1_direct), $field1_direct, mysqli_errno($link), mysqli_error($link));
}
if ($tmp[1] != $field1_direct) {
printf("[015] mysqli_fetch_field_direct() differs from mysqli_fetch_fields()\n");
var_dump($field1_direct);
var_dump($tmp);
}
if (1 !== ($tmp = mysqli_field_tell($res))) {
printf("[016] Expecting int/1, got %s/%s, [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
}
mysqli_free_result($res);
mysqli_stmt_close($stmt);
示例8: testStatement
function testStatement($offset, $link, $sql, $expected_lib, $expected_mysqlnd, $check_mysqlnd, $compare)
{
if (!($stmt = mysqli_stmt_init($link))) {
printf("[%04d - %s] [%d] %s\n", $offset, $sql, mysqli_errno($link), mysqli_error($link));
return false;
}
if (!@mysqli_stmt_prepare($stmt, $sql)) {
/* Not all server versions will support all statements */
/* Failing to prepare is OK */
return true;
}
if (empty($expected_lib) && false !== $res) {
printf("[%04d - %s] No metadata expected\n", $offset + 1, $sql);
return false;
} else {
if (!empty($expected_lib) && false == $res) {
printf("[%04d - %s] Metadata expected\n", $offset + 2, $sql);
return false;
}
}
if (!empty($expected_lib)) {
if (!is_object($res)) {
printf("[%04d - %s] [%d] %s\n", $offset + 3, $sql, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if (get_class($res) != 'mysqli_result') {
printf("[%04d - %s] Expecting object/mysqli_result got object/%s\n", $offset + 4, $sql, get_class($res));
return false;
}
$meta = array('num_fields' => mysqli_num_fields($res), 'fetch_field' => mysqli_fetch_field($res), 'fetch_field_direct0' => mysqli_fetch_field_direct($res, 0), 'fetch_field_direct1' => @mysqli_fetch_field_direct($res, 1), 'fetch_fields' => count(mysqli_fetch_fields($res)), 'field_count' => $res->field_count, 'field_seek-1' => @mysqli_field_seek($res, -1), 'field_seek0' => mysqli_field_seek($res, 0), 'field_tell' => mysqli_field_tell($res));
if (is_object($meta['fetch_field'])) {
$meta['fetch_field']->charsetnr = 'ignore';
$meta['fetch_field']->flags = 'ignore';
}
if (is_object($meta['fetch_field_direct0'])) {
$meta['fetch_field_direct0']->charsetnr = 'ignore';
$meta['fetch_field_direct0']->flags = 'ignore';
}
if (is_object($meta['fetch_field_direct1'])) {
$meta['fetch_field_direct1']->charsetnr = 'ignore';
$meta['fetch_field_direct1']->flags = 'ignore';
}
mysqli_free_result($res);
if ($meta != $expected_lib) {
printf("[%04d - %s] Metadata differs from expected values\n", $offset + 5, $sql);
var_dump($meta);
var_dump($expected_lib);
return false;
}
}
if (function_exists('mysqli_stmt_get_result')) {
/* mysqlnd only */
if (!mysqli_stmt_execute($stmt)) {
printf("[%04d - %s] [%d] %s\n", $offset + 6, $sql, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
$res = mysqli_stmt_get_result($stmt);
if (false === $res && !empty($expected_mysqlnd)) {
printf("[%04d - %s] Expecting resultset [%d] %s\n", $offset + 7, $sql, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
} else {
if (empty($expected_mysqlnd) && false !== $res) {
printf("[%04d - %s] Unexpected resultset [%d] %s\n", $offset + 8, $sql, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
}
if (!is_object($res)) {
printf("[%04d - %s] [%d] %s\n", $offset + 9, $sql, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if ('mysqli_result' != get_class($res)) {
printf("[%04d - %s] Expecting object/mysqli_result got object/%s\n", $offset + 10, $sql, get_class($res));
return false;
}
$meta_res = array('num_fields' => mysqli_num_fields($res), 'fetch_field' => mysqli_fetch_field($res), 'fetch_field_direct0' => mysqli_fetch_field_direct($res, 0), 'fetch_field_direct1' => @mysqli_fetch_field_direct($res, 1), 'fetch_fields' => count(mysqli_fetch_fields($res)), 'field_count' => mysqli_field_count($link), 'field_seek-1' => @mysqli_field_seek($res, -1), 'field_seek0' => mysqli_field_seek($res, 0), 'field_tell' => mysqli_field_tell($res));
if (is_object($meta_res['fetch_field'])) {
$meta_res['fetch_field']->charsetnr = 'ignore';
$meta_res['fetch_field']->flags = 'ignore';
}
if (is_object($meta_res['fetch_field_direct0'])) {
$meta_res['fetch_field_direct0']->charsetnr = 'ignore';
$meta_res['fetch_field_direct0']->flags = 'ignore';
}
if (is_object($meta_res['fetch_field_direct1'])) {
$meta_res['fetch_field_direct1']->charsetnr = 'ignore';
$meta_res['fetch_field_direct1']->flags = 'ignore';
}
mysqli_free_result($res);
if ($check_mysqlnd && $meta_res != $expected_mysqlnd) {
printf("[%04d - %s] Metadata differs from expected\n", $offset + 11, $sql);
var_dump($meta_res);
var_dump($expected_mysqlnd);
} else {
if ($meta_res['field_count'] < 1) {
printf("[%04d - %s] Metadata seems wrong, no fields?\n", $offset + 12, $sql);
var_dump($meta_res);
var_dump(mysqli_fetch_assoc($res));
}
}
if ($compare && $meta_res != $meta) {
//.........这里部分代码省略.........
示例9: mysql_field_seek
function mysql_field_seek($result, $offset)
{
return mysqli_field_seek($result, $offset);
}
示例10: mysql_compat_field_seek
function mysql_compat_field_seek($result, $field_offset)
{
return mysqli_field_seek($result, $field_offset);
}
示例11: pg_num_fields
case 'postgres':
$cols = pg_num_fields($DB->_result);
for ($i = 0; $i < $cols; $i++) {
$colnames[] = pg_field_name($DB->_result, $i);
}
break;
case 'mysql':
$cols = mysql_num_fields($DB->_result);
for ($i = 0; $i < $cols; $i++) {
$colnames[] = mysql_field_name($DB->_result, $i);
}
break;
case 'mysqli':
$cols = mysqli_num_fields($DB->_result);
for ($i = 0; $i < $cols; $i++) {
mysqli_field_seek($DB->_result, $i);
$finfo = mysqli_fetch_field($DB->_result);
$colnames[] = $finfo->name;
}
break;
}
if ($_GET['print']) {
$classes = array(0 => 'grey', 1 => 'white');
} else {
$classes = array(0 => 'light', 1 => 'lucid');
}
$i = 0;
while ($row = $DB->_driver_fetchrow_assoc()) {
$i++;
if ($i > $start && $i < $start + $pagelimit + 1) {
$result .= '<TR CLASS="' . $classes[$i % 2] . '"><TD CLASS="BLEND">' . $i . '</TD>';
示例12: FetchField
function FetchField($fieldOffset = -1)
{
$fieldnr = $fieldOffset;
if ($fieldOffset != -1) {
$fieldOffset = @mysqli_field_seek($this->_queryID, $fieldnr);
}
$o = @mysqli_fetch_field($this->_queryID);
if (!$o) {
return false;
}
//Fix for HHVM
if (!isset($o->flags)) {
$o->flags = 0;
}
/* Properties of an ADOFieldObject as set by MetaColumns */
$o->primary_key = $o->flags & MYSQLI_PRI_KEY_FLAG;
$o->not_null = $o->flags & MYSQLI_NOT_NULL_FLAG;
$o->auto_increment = $o->flags & MYSQLI_AUTO_INCREMENT_FLAG;
$o->binary = $o->flags & MYSQLI_BINARY_FLAG;
// $o->blob = $o->flags & MYSQLI_BLOB_FLAG; /* not returned by MetaColumns */
$o->unsigned = $o->flags & MYSQLI_UNSIGNED_FLAG;
/*
* Trivial method to cast class to ADOfieldObject
*/
$a = new ADOFieldObject();
foreach (get_object_vars($o) as $key => $name) {
$a->{$key} = $name;
}
return $a;
}
示例13: conectar
$con = conectar();
$sql = " SELECT * FROM funcionario WHERE usuario = '{$_POST['NOMBRE_F']}' AND pw ='" . md5($_POST[PW]) . "'";
//código MySQL
$q = mysqli_query($con, $sql);
//enviar código MySQL
while ($row = mysqli_fetch_array($q)) {
//Bucle para ver todos los registros
$_SESSION["id_funcionario"] = $row['id_Funcionario'];
$_SESSION["nombre"] = $row['nombre_f'];
$_SESSION["apellido"] = $row['apellido_f'];
$_SESSION["password"] = $row['pw'];
$_SESSION['tipo'] = $row['tipo'];
$_SESSION['ccp'] = $row['ccp'];
}
try {
if (mysqli_field_seek($q, 0)) {
if ($_SESSION['tipo'] == "administrador") {
echo "<script language='Javascript'>\n\t\t\t\t\t\talert('Bienvenido " . ucwords($_SESSION['nombre']) . " " . ucwords($_SESSION['apellido']) . "');\n\t\t\t\t\t\tdocument.location=('../procesar/iniciar.php');\n\t\t\t\t\t\t</script>";
} else {
echo "<script language='Javascript'>\n\t\t\t\t\t\t\talert('Bienvenido " . ucwords($_SESSION['nombre']) . " " . ucwords($_SESSION['apellido']) . "');\n\t\t\t\t\t\t\tdocument.location=('../procesar/iniciar.php');\n\t\t\t\t\t\t\t</script>";
}
} else {
echo "<script language='Javascript'>\n\t\t\t\t\talert('Usuario y/o Contraseña Erronea');\n\t\t\t\t\tdocument.location=('../index.php');\n\t\t\t\t\t</script>";
}
} catch (Exception $error) {
}
mysqli_close($con);
} else {
echo "<script language='javascript'>\n\t\t\t\talert('Debe Llenar Todos los Campos');\n\t\t\t\tdocument.location=('../index.php');\n\t\t\t</script>";
}
} else {
示例14: mysql_field_seek
function mysql_field_seek($result, $offset)
{
if (!is_myresource($result, true)) {
$msg = sprintf('expects parameter 1 to be mysql result object, %s given', gettype($result));
trigger_error(mysql_trigger_msg($msg, current(debug_backtrace())), E_USER_WARNING);
return false;
}
if (!isset($offset)) {
$msg = sprintf('expects parameter 2 to be offset value');
trigger_error(mysql_trigger_msg($msg, current(debug_backtrace())), E_USER_WARNING);
return false;
}
if ($offset < 0 || $offset >= mysqli_num_fields($result)) {
$msg = sprintf('Unable to jump to field %ld on MySQL result index %d', $offset, $result);
trigger_error(mysql_trigger_msg($msg, current(debug_backtrace())), E_USER_WARNING);
return false;
}
return mysqli_field_seek($result, $offset);
}
示例15: FieldName
/**
* Метод, преднязначенный для получения названия указанной колонки результата запроса
*
* @param int $i - индекс колонки
* @return string
* @access public
*/
function FieldName($i)
{
if (is_array($this->_result)) {
$a = current($this->_result);
$b = array_keys($a);
return $b[$i];
}
mysqli_field_seek($this->_result, $i);
$field = mysqli_fetch_field($this->_result);
return $field->name;
}