I need to send Title to see if its exist, and return yes or no, I don’t need that it return something except that if the Title is already exist. What is the best way to do this.
Dec 20, 2009, 6:15 AM
Veteran / Moderator (17366 posts)
Dec 20, 2009, 6:15 AM
Post #2 of 5
Views: 602
Should be pretty simple:
check_if_title_exists
if ($DB->table('Links')->count( { Title => $_[0] } ) > 0) {
return { title_exists => 1 }
} else {
return { title_exists => 0 }
}
}
Then call with:
<%if title_exists%> the title exists <%else%> it doesnt exist <%endif%>
Cheers
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
check_if_title_exists
Code:
sub { if ($DB->table('Links')->count( { Title => $_[0] } ) > 0) {
return { title_exists => 1 }
} else {
return { title_exists => 0 }
}
}
Then call with:
Code:
<%check_if_title_exists($Title)%> <%if title_exists%> the title exists <%else%> it doesnt exist <%endif%>
Cheers
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Dec 20, 2009, 6:26 AM
Veteran / Moderator (17366 posts)
Dec 20, 2009, 6:26 AM
Post #4 of 5
Views: 599
Should work with this:
check_if_title_exists
my $cond = new GT::CGI::Condition;
$cond->add('Title','=',$_[0]);
$cond->add('URL','=',$_[1]);
$cond->bool('OR');
if ($DB->table('Links')->count( $cond ) > 0) {
return { title_exists => 1 }
} else {
return { title_exists => 0 }
}
}
<%if title_exists%> the title exists <%else%> it doesnt exist <%endif%>
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
check_if_title_exists
Code:
sub { my $cond = new GT::CGI::Condition;
$cond->add('Title','=',$_[0]);
$cond->add('URL','=',$_[1]);
$cond->bool('OR');
if ($DB->table('Links')->count( $cond ) > 0) {
return { title_exists => 1 }
} else {
return { title_exists => 0 }
}
}
Code:
<%check_if_title_exists($Title,$URL)%> <%if title_exists%> the title exists <%else%> it doesnt exist <%endif%>
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates

