Can someone look at this code - it's killing my univserse.
This .cgi searches for entries in a textfile only in one particular data field - it's intended to find just the one entry by its ID number, and to then use the information for that record to print an informational page on just that entry - however, even when I enter the exact number as a search string it pulls all of the entries in teh database, even though they have different ID numbers. Please -help!
#build the search line with all fields we want to search in
$searchline = $vendor_number;
#search by keywords
# only perform the keyword search if the length of the search string is greater than 2
# don't think we want people to search for and or or etc.
$sfound = 0;
$found = 0;
$notfound = 1;
$stlen = length($searchstring);
if ($stlen > 1) {
@words = split(/ +/,$searchstring);
foreach $aword (@words) {
if ($searchline = /\b$aword/i) {
$sfound = 1;
}
else {
$notfound = 0;
}
}
}
if ($sfound == 1 && $notfound == 1) {
$found = 1;
}
# if search string is too small .. set found to 1
if ($stlen <= 1) {
$found = 1;
}
#if page doesn't have a title then return not found
$tlen = length($linktitle);
if ($tlen < 1) {
$found = 0;
}
}
This .cgi searches for entries in a textfile only in one particular data field - it's intended to find just the one entry by its ID number, and to then use the information for that record to print an informational page on just that entry - however, even when I enter the exact number as a search string it pulls all of the entries in teh database, even though they have different ID numbers. Please -help!
#build the search line with all fields we want to search in
$searchline = $vendor_number;
#search by keywords
# only perform the keyword search if the length of the search string is greater than 2
# don't think we want people to search for and or or etc.
$sfound = 0;
$found = 0;
$notfound = 1;
$stlen = length($searchstring);
if ($stlen > 1) {
@words = split(/ +/,$searchstring);
foreach $aword (@words) {
if ($searchline = /\b$aword/i) {
$sfound = 1;
}
else {
$notfound = 0;
}
}
}
if ($sfound == 1 && $notfound == 1) {
$found = 1;
}
# if search string is too small .. set found to 1
if ($stlen <= 1) {
$found = 1;
}
#if page doesn't have a title then return not found
$tlen = length($linktitle);
if ($tlen < 1) {
$found = 0;
}
}