Gossamer Forum
Home : Products : DBMan : Customization :

Using ID number

Quote Reply
Using ID number
Hi

I need every record in my db to have a unique number, to help avoid duplication, I would like to use the id number generated by db.cgi, but I need it in the following format

AJ#### were # represents a number example

AJ0001 ..AJ0002 etc, is this easily acheived, the letters AJ will never change, just the number using 4 digits

thanks for any help

DavyC
http://www.amijet.com
Life's more fun in a virtual world
Quote Reply
Re: Using ID number In reply to
Try the following:

if ($in{'add_record'}) {
for ($i = 0; $i < length($rec{'ID'}); $i++) { $rec{'ID'} = '0' . $rec{'ID'}; }
$rec{'ID'} = 'AJ' . $rec{'ID'};
}


Add it to html_record_form under the line my (%rec) = @_;

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Using ID number In reply to
Hi
Thanks for the help really appreciated will give it a go


thanks

DavyC
http://www.amijet.com
Life's more fun in a virtual world