Hello,
I'm really new to regular expressions and I was wondering if anyone could give me a hand. What I have is some data on mySQL which contains `title`, and `keywords` and I want the user to search through the title and keywords. Here's an example:
Table: games
ID | Title | Keywords
1 | Blah 1 | rpg,quest,3D
2 | Blah 2 | 3D,quest,real-time
I want to search through the title and keywords and this is what I have:
$sql = qq[select title,keywords from index_tble];
my $sth = $dbh->prepare("$sql"
$sth->execute or print("Cannot execute statement!<br>".$sth->errstr);
while(@row = $sth->fetchrow) {
if ($row[0] =~/$q/ || $row[1] =~/$q/) {
print "$row[0]"
}
###Blah....
}
But If I search for like: some quest games, it doesn't search for the 'quest' that is already on the keyword list. Any idea or tips? Thanks!
I'm really new to regular expressions and I was wondering if anyone could give me a hand. What I have is some data on mySQL which contains `title`, and `keywords` and I want the user to search through the title and keywords. Here's an example:
Table: games
ID | Title | Keywords
1 | Blah 1 | rpg,quest,3D
2 | Blah 2 | 3D,quest,real-time
I want to search through the title and keywords and this is what I have:
$sql = qq[select title,keywords from index_tble];
my $sth = $dbh->prepare("$sql"
$sth->execute or print("Cannot execute statement!<br>".$sth->errstr);
while(@row = $sth->fetchrow) {
if ($row[0] =~/$q/ || $row[1] =~/$q/) {
print "$row[0]"
}
###Blah....
}
But If I search for like: some quest games, it doesn't search for the 'quest' that is already on the keyword list. Any idea or tips? Thanks!