<?php

function del#record#(){
	$#primarykey#=GETVAL('#primarykey#');
	global $db;
	$user=userinfo();
	$gsid=$user['gsid']+0;
	
	checkgskey('del#record#_'.$#primarykey#);	
	
	$query="select * from #tablename# where gsid=? and #primarykey#=?";
	$rs=sql_prep($query,$db,array($gsid,$#primarykey#));
	if (!$myrow=sql_fetch_array($rs)) die('Invalid #record# record');
	
	$#dispfield#=$myrow['#dispfield#'];
	
	$query="delete from #tablename# where gsid=? and #primarykey#=?";
	sql_prep($query,$db,array($gsid,$#primarykey#));
	
	logaction("deleted #c_record# #$#primarykey# $#dispfield#",
		array('#primarykey#'=>$#primarykey#,'#dispfield#'=>$#dispfield#),
		array('rectype'=>'#record#','recid'=>$#primarykey#));
}