bazz
08-26-2007, 06:59 PM
Hi,
I am trying to match a field entry to four letters of a textbox (form) entry. It seesm only to work with the first four letters of the field value whereas I want to check the whole field 'string' for a potential match.
Any pointers on what I am missing?
The filed value is 'johny soap t/a metharg'
I want to match the 'harg' no matter whether it's at the beginning of the field value or the end.
my $shortenedGroup = substr($groupToAdd, 0,4);
print qq(shortenedGroup = $shortenedGroup<br />); # OUTPUTS (for example, 'harg')
my $dbh = DBI->connect("DBI:mysql:$db:$srv:$port", $user, $pass,
{RaiseError => 1, PrintError => 0})
or die "Can't connect: DBI->errstr()";
my $sth = $dbh->prepare("SELECT Business_Group_Name From $table
WHERE Business_Group_Name LIKE '${shortenedGroup}%' ");
$sth->execute;
As ever, your help and pointers will be appreciated
bazz
I am trying to match a field entry to four letters of a textbox (form) entry. It seesm only to work with the first four letters of the field value whereas I want to check the whole field 'string' for a potential match.
Any pointers on what I am missing?
The filed value is 'johny soap t/a metharg'
I want to match the 'harg' no matter whether it's at the beginning of the field value or the end.
my $shortenedGroup = substr($groupToAdd, 0,4);
print qq(shortenedGroup = $shortenedGroup<br />); # OUTPUTS (for example, 'harg')
my $dbh = DBI->connect("DBI:mysql:$db:$srv:$port", $user, $pass,
{RaiseError => 1, PrintError => 0})
or die "Can't connect: DBI->errstr()";
my $sth = $dbh->prepare("SELECT Business_Group_Name From $table
WHERE Business_Group_Name LIKE '${shortenedGroup}%' ");
$sth->execute;
As ever, your help and pointers will be appreciated
bazz