php dba函数之dba_fetch()

时间:2016-07-10
php dba_fetch()函数用于取得指定key的值,本文章向大家介绍dba_fetch()函数的基本语法和基本使用实例,需要的朋友可以参考一下本文章。

dba_fetch()介绍

1、语法

string dba_fetch ( string $key , resource $handle )

通过指定的key获取数据

2、参数

  1. string $key key值
  2. resource $handle 数据库的handler,通过dba_open(), dba_popen() 返回

3、返回值

如果key对应的value值存在,返回data字符串,否则返回FALSE

dba_fetch()实例

$dbh = dba_open( "./data/products", "c", "db4" )
       or die( "Couldn't open database" );
$tricorder = dba_fetch('Tricorder', $dbh);
dba_close($dbh);