I spent a long time writing a client and server program on my windows machine that monitors program usage, user statistics, logged in status of machines here where I work. Everything had run smoothly on my windows machine until it crashed and I moved my server code over to my gentoo linux machine. Now I'm running into a lot of issues with code that had been working before and nothing had changed. My current problem is the following: The server gathers all software numbers for a monitored software list and totals them up into a total value for the software hash. When I do a foreach loop against the keys in the hash to then update the software totals in the DB nothing is being updated. I've narrowed the issue down to the software name that isn't working. Here is the loop
foreach $key1(keys(%prog_numbers)) { $update = $ldb->prepare("UPDATE LOW_PRIORITY $ldbtable SET $mtime=$pro +g_numbers{$key1} WHERE software=\"$key1\""); $showfail = $update->execute; $update->finish();
All the other variables are working fine and if I change $key1 to say "firefox.exe" it works, but for some reason it just doesn't want to update using the keys. I've tried putting all the keys into normal arrays and it still won't update due to the WHERE part of the query. The query itself runs but $showfail equals 0 and the my debug file simply says "UPDATE FAILED" with no explanation. I've also tried other loops like for, nested foreach, etc and still no go. Thank you for your time. Seth

In reply to DB update query from Linux using a Hash array by sethwalsh

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.