esult($query,$j+1); } $rdList[$i] = $info; $i++; } return $rdList; }
//==================================== // update record // 更新记录 //==================================== function updateInfo($table,$field,$id,$set){ $connstr = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=database/email.mdb"; $connid = @odbc_connect($connstr,"","",SQL_CUR_USE_ODBC ) or die ("数据库连接错误!"); $sql = "update ".$table." set ".$set." where ".$field."=".$id; $query = @odbc_do($connid,$sql); }
//==================================== // record delete // 删除记录 //==================================== function delRd($table,$field,$id){ $connstr = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=database/email.mdb"; $connid = @odbc_connect($connstr,"","",SQL_CUR_USE_ODBC ) or die ("数据库连接错误!"); $sql = "delete from ".$table." where ".$field."=".$id; $query = @odbc_do($connid,$sql); }
//==================================== // record delete cat // 删除记录(条件) //==================================== function delOrRd($table,$condition){ $connstr = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=database/email.mdb"; $connid = @odbc_connect($connstr,"","",SQL_CUR_USE_ODBC ) or die ("数据库连接错误!"); $sql = "delete from ".$table." where ".$condition; $query = @odbc_do($connid,$sql); }
//==================================== // count record // 取得记录数 //==================================== function countRd($table,$condition=""){ $connstr = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=database/email.mdb"; $connid = @odbc_connect($connstr,"","",SQL_CUR_USE_ODBC ) or die ("数据库连接错误!"); $sql = "select count(*) as num from ".$table." ".$condition; $query = @odbc_do($connid,$sql); odbc_fetch_row($query); $num = odbc_result($query,1); return $num; }
?> |