get("db"); $conn = mysql_pconnect($db_conf['host'],$db_conf['user'],$db_conf['passwd']); $conf->set("dbh",$conn); } function checkConn () { $conf = Conf::instance(); if(! $conf->get("dbh")) { conn(); } } function ins ($sql) { $conf = Conf::instance(); checkConn(); disconnect(); return mysql_query($sql, $conf->get("dbh")); } function sel ($sql) { $conf = Conf::instance(); checkConn(); $array = array(); $results = mysql_query($sql, $conf->get("dbh")); while($row = mysql_fetch_assoc($results)) { $array[]=$row; } mysql_free_result($results); disconnect(); return $array; } function del ($sql) { $conf = Conf::instance(); checkConn(); mysql_query($sql, $conf->get("dbh")); } function disconnect () { $conf = Conf::instance(); $conn = $conf->get("dbh"); mysql_close($conn); $conf->set("dbh", 0); } } ?>