<?php

function del#record#(){
	$#primarykey#=GETVAL('#primarykey#');
	global $db;
	
	checkgskey('del#record#_'.$#masterkey#);	
	
	//gsguard if applicable
	
	$query="select * from #tablename# where #primarykey#=?";
	$rs=sql_prep($query,$db,$#primarykey#);
	if (!$myrow=sql_fetch_array($rs)) die('Invalid #record# record');
	
	$#dispfield#=$myrow['#dispfield#'];
	
	$query="delete from #tablename# where #primarykey#=?";
	sql_prep($query,$db,$#primarykey#);
	
	logaction("deleted #c_record# #$#primarykey# $#dispfield#",
		array('#primarykey#'=>$#primarykey#,'#dispfield#'=>$#dispfield#),
		array('rectype'=>'#master_record##records#','recid'=>$#masterkey#)
		);
}