輸入待尋字串
  <?php
  require("http://php.wilson.gs");  // 回首頁
  echo "http://php.wilson.gs/bible/function.php : 函式:mysql_field_type()";


函式:mysql_field_type()


mysql_field_type

獲得目前欄位的型態。

語法: string mysql_field_type(int result, int field_offset);

傳回值: 字串

函式種類: 資料庫功能

內容說明

本函式可以得到目前所在欄位的型態格式。傳回的字串為欄位的型態,包括了 int、real、string、blob....等等,詳見 MySQL 的相關文件中有關於型態的部份。

使用範例

<?php
mysql_connect
("localhost:3306");
mysql_select_db("wisconsin");
$result mysql_query("SELECT * FROM onek");
$fields mysql_num_fields($result);
$rows   mysql_num_rows($result);
$i 0;
$table mysql_field_table($result$i);
echo 
"資料表 '".$table."' 有 ".$fields." 欄及 ".$rows." 列。<br>";
echo 
"本資料表的欄位如下<br>";
while (
$i $fields) {
    
$type  mysql_field_type  ($result$i);
    
$name  mysql_field_name  ($result$i);
    
$len   mysql_field_len   ($result$i);
    
$flags mysql_field_flags ($result$i);
    echo 
$type." ".$name." ".$len." ".$flags."<br>";
    
$i++;
}
mysql_close();
?>


[ 上一頁 /bible/function.php 下一頁 ]



本站置於 NEC BIGLOBE 地球村網際網路  echo "Copyright © 1999-2001, Wilson Peng";  //隱私權保護政策
  mail("wilson@biglobe.net.tw", "Feedback", $message);
  ?>