I wonder if you issue might be that you are UPPER'ing the search parameter but not the field. So if the field holds "eric" and you search for "e" it isn't going to work because "eric" is not like "%E%". Below is your code formated differently, to each his own, but i find this much easier to read. I also added a call to $dbh->quote() so that users can't shove scary bad stuff into your query.
my %incoming = &read_input; # Read information into associated # array %incoming. my $mainsearch = $incoming{'yoursearch'}; # Fetch the text from the array. my $maintable = $incoming{'yourtable'}; # Fetch the text from the array. #Start DBI my $dbh = DBI->connect("dbi:xxxxxxxxxxx", "xxxxxxx", "xxxxxxxx"); #quote the search in case the user tries to hide something nasty in th +ere $mainsearch = $dbh->quote($mainsearch); my $st = $dbh->prepare(" select * from ( select * from qatest where UPPER(ser_app_name) like upper('%$mainsearch%') or UPPER(att_data) like upper('%$mainsearch%') or UPPER(mrserver) like upper('%$mainsearch%') or UPPER(owner_user) like upper('%$mainsearch%') or UPPER(lan_serv) like upper('%$mainsearch%') or UPPER(s_contact) like upper('%$mainsearch%') or UPPER(s_provider) like upper('%$mainsearch%') or UPPER(prod_deliv) like upper('%$mainsearch%') order by ser_app_name ASC ) where rownum < 31"); $st->execute();
In reply to Re: Perl DBI / Variable Question
by eric256
in thread Perl DBI / Variable Question
by Trihedralguy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |