mysqli_field_tell,とは?

辞典・百科事典の検索サービス - Weblio辞書

初めての方へ

参加元一覧


用語解説|全文検索
Weblio 辞書 > コンピュータ > PHP関数リファレンス > mysqli_field_tell,の意味・解説 

PHP関数リファレンス

PHP Documentation GroupPHP Documentation Group

mysqli_field_tell,

(PHP 5)
mysqli_field_tell, result->current_field — 結果ポインタにおける現在のフィールドオフセットを取得する

説明

手続き型:
int mysqli_field_tell ( mysqli_result result )
オブジェクト指向型(プロパティ):
class mysqli_result {
int current_field
} 直近の mysqli_fetch_field() のコールで使用した フィールドカーソルの位置を返します。この値は mysqli_field_seek() の引数として使用可能です。

パラメータ

result
手続き型のみ: mysqli_query()mysqli_store_result() あるいは mysqli_use_result() が返す結果セット ID。

返り値

フィールドカーソルの現在のオフセットを返します。

例 1406. オブジェクト指向型
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");

/* 接続状況をチェックします */
if (mysqli_connect_errno()) {
   printf("Connect failed: %s\n", mysqli_connect_error());
   exit();
}

$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";

if ($result = $mysqli->query($query)) {

   /* すべてのカラムのフィールド情報を取得します */
   while ($finfo = $result->fetch_field()) {

       /* フィールドポインタのオフセットを取得します */
       $currentfield = $result->current_field;

       printf("Column %d:\n", $currentfield);
       printf("Name:    %s\n", $finfo->name);
       printf("Table:    %s\n", $finfo->table);
       printf("max. Len: %d\n", $finfo->max_length);
       printf("Flags:    %d\n", $finfo->flags);
       printf("Type:    %d\n\n", $finfo->type);
   }
   $result->close();
}

/* 接続を閉じます */
$mysqli->close();
?>

例 1407. 手続き型
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");

/* 接続状況をチェックします */
if (mysqli_connect_errno()) {
   printf("Connect failed: %s\n", mysqli_connect_error());
   exit();
}

$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";

if ($result = mysqli_query($link, $query)) {

   /* すべてのカラムのフィールド情報を取得します */
   while ($finfo = mysqli_fetch_field($result)) {

       /* フィールドポインタのオフセットを取得します */
       $currentfield = mysqli_field_tell($result);

       printf("Column %d:\n", $currentfield);
       printf("Name:    %s\n", $finfo->name);
       printf("Table:    %s\n", $finfo->table);
       printf("max. Len: %d\n", $finfo->max_length);
       printf("Flags:    %d\n", $finfo->flags);
       printf("Type:    %d\n\n", $finfo->type);
   }
   mysqli_free_result($result);
}

/* 接続を閉じます */
mysqli_close($link);
?>

上の例の出力は以下となります。

Column 1:
Name:     Name
Table:    Country
max. Len: 11
Flags:    1
Type:     254

Column 2:
Name:     SurfaceArea
Table:    Country
max. Len: 10
Flags:    32769
Type:     4


  

参考

mysqli_fetch_field()
mysqli_field_seek()






mysqli_field_tell,のページへのリンク
「mysqli_field_tell,」の関連用語
mysqli_field_tell,のお隣キーワード
モバイル
モバイル版のWeblioは、下記のURLからアクセスしてください。
http://m.weblio.jp/
_ _   


mysqli_field_tell,のページの著作権
Weblio 辞書情報提供元は参加元一覧にて確認できます。

  
PHP Documentation GroupPHP Documentation Group
Copyright © 1997 - 2012 by the PHP Documentation Group.

©2012 Weblio RSS