I'm having some variable problem in conjunction with DBI...

What is happening is that I'm using a variable called $mainsearch that i get from the user in a form GET and it taking it in and making $mainsearch (you will see below)...But when I do a select in Oracle (using DBI) the first statement uses the variable and it seem that the variable 'loses its data' which means the rest of the statments dont bring up the right stuff...Maybe someone can help me out, tell me what im doing wrong. Basically here are my code snippets:

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"); my $st = $dbh->prepare(" select * from ( select * from qatest where ser_app_name like upper('%$mainsearch%') or att_data like upper('%$mainsearch%') or mrserver like upper('%$mainsearch%') or owner_user like upper('%$mainsearch%') or lan_serv like upper('%$mainsearch%') or s_contact like upper('%$mainsearch%') or s_provider like upper('%$mainsearch%') or prod_deliv like upper('%$mainsearch%') order by ser_app_name ASC ) where rownum < 31 "); $st->execute();

Please someone give me some insight ive been looking on google and perl sites all day with no resolution in-sight!

>>>UPDATE: I cant figure out how to format on this website, I cant seem to put line breaks in :(

20070124 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips


In reply to Perl DBI / Variable Question by Trihedralguy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.