Ok, maybe I'm a moron 'cause I'm not seeing it, but *what* are these things - `Stat`, `Project`, and `Version`??? If Stat, Project, and Version are column names, then you *don't* need to quote them, especially with backticks, which have special meaning in Perl.

And, as hardburn already said, and others including myself have suggested to you before in previous nodes, USE PLACEHOLDERS. Is there a reason that you are intentionally not using placeholders?

In this code:
while (my ($identifier)=$sth->fetchrow_array ) {
fetchrow_array returns an *array* - not an array reference. So, $identifier in that line should be @identifier. Or, change fetchrow_array to fetchrow_arrayref.

Another problem which others have already pointed out - when you do 'select *', you have no idea what order the columns are being fetched in. If you explicitely named the columns in the select, then you know what order they are fetched in so you can order the fields receiving the fetch, like this:
my $sth=$dbh->prepare(qq{ SELECT name, state, phone FROM user }); $sth->execute(); while (my ($name, $state, $phone)=$sth->fetchrow_array ) { ### now you can use $name, $state, and $phone ### print "User name: $name\n"; print " state: $state\n"; print " phone: $phone\n"; } $sth->finish;
HTH.

In reply to Re: selecting again from a mysql database by hmerrill
in thread selecting again from a mysql database by bory

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.