/* * @ access class * insert,update,delete record * version 1.0 * date 2005.6 * power by Samsun Manzalo (34n 豬八戒) * www.cncms.com */
//==================================== // insert record // 插入記錄 //==================================== function insRd($table,$field){ $connstr = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=database/email.mdb"; $connid = @odbc_connect($connstr,"","",SQL_CUR_USE_ODBC ) or die ("資料庫連接錯誤!"); $tmpA = explode(',',$field); $ins = ''; for($i=0;$i $ins.= "'".$_POST[$tmpA[$i]]."',"; } $ins = substr($ins,0,-1); $sql = "INSERT INTO ".$table." (".$field.") VALUES (".$ins.")"; //echo $sql;exit; $query = @odbc_do($connid,$sql); }
//==================================== // get one record detail // 取得當條記錄詳細資料 //==================================== function getInfo($table,$field,$id,$colnum){ $connstr = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=database/email.mdb"; $connid = @odbc_connect($connstr,"","",SQL_CUR_USE_ODBC ) or die ("資料庫連接錯誤!"); $sql = "select * from ".$table." where ".$field."=".$id; $query = @odbc_do($connid,$sql);