This Domain(Admin5.com) is for Sale:

国外好东西真的多,现在贴上一个访问ACCESS的类!

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

}
}
// 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;
}
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);
unset($this->DBM);
return $results;
}

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

}
?>

这个连接上!
include("class.AccessDBM.php3");
$static = true;
$dbase = new AccessDBM("/path/to/file.dbm",$static);


register_shutdown_function($dbase->static_close());


if(!$dbase->add_entry("cdi","cdi@thewebmasters.net))
{
echo "Error adding entry: $dbase->ERROR";
}

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

文章评论

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

24小时热门信息