This Domain(Admin5.com) is for Sale:

一个访问ACCESS的类

时间:2007-12-23  来源:不详  作者:迈克DB

// strip the first whitespace char and
// everything after it.
$test = ereg_replace(" .*","",$key);
if(eregi("^$test",$search))
{
$val = dbmfetch($dbm,$key);
$this->close_dbm($dbm);
error_log("test [$test] matched [$search]",0);
return $val;
}
$key = dbmnextkey($dbm,$key);
}
}
// didn't find it
$this->close_dbm($dbm);
return false;
}

// *******************************************************

// returns the key
function find_val ($search)
{
$this->exact = false;

$dbase = $this->get_all();
if(empty($dbase))
{
error_log("error dbase is empty $db->error",0);
return false;
} dedecms.com
while ( list ( $key, $val ) = each ($dbase) )
{
if($search == $val)
{
$this->exact=true;
return $key;
}
else
{
// strip the first whitespace char and
// everything after it.

$test = ereg_replace(" .*","",$val);

if(eregi("^$test",$search))
{
$this->exact = false;
return $key;
}
}
}
// didn't find it
return false;
}

// *******************************************************

function get_all ()
{
$values = array();
$count = 0;
$readonly = true;
$dbm = $this->open_dbm($readonly);
if(!$dbm) { return false; }

$key = dbmfirstkey($dbm);

while ($key)
织梦内容管理系统

{
$val = dbmfetch($dbm,$key);
$values[$key] = $val;
$count ;
$key = dbmnextkey($dbm, $key);
}
$this->count = $count;
$this->values = $values;
$this->close_dbm($dbm);
return $values;
}

// *******************************************************

function close_dbm ($dbm)
{
$results = false;

if(!$this->static)
{
$results = dbmclose($dbm);
}
return $results;
}


// *******************************************************

function static_close()
{
$results = false;

if(!$this->dbm)
{
$this->error = "no static dbm to close";
return false;
}
$dbm = $this->dbm;
$results = dbmclose($dbm);

看完这篇,您有何感觉呢?

文章评论

共有位Admini5网友发表了评论 查看完整内容

24小时热门信息