Gossamer Forum
Home : General : Perl Programming :

Letting duplication happen

Quote Reply
Letting duplication happen
Hi,

Can you tell me what part of this code looks for duplicates? What I would like to do is allow duplicates to be submitted.

Code:

my $links_sth = $db->select ( { URL => $input->{URL} }, ['ID'] );
if ($links_sth->rows) {
import_print("Unable to import `$_' (line $. of $$vars{full_path}): URL already existed in the database\n");
next;
}


Thanks in advance
Quote Reply
Re: [Teambldr] Letting duplication happen In reply to
Hi,

It would be the;

Code:
if ($links_sth->rows) {
...
}

part. Basically, the my $links_sth = $db->select ... bit gets the records, and if $links_sth->rows (the number of grabbed results) is greater than 0, it will come up as true (and thus it exists already).

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!