Hi,
I'm newbie and got stuck with something weird on sql query via Perl. As long as I don't use any specific field name in query statement I'm fine, but if not error appears - so Get_House_Security_Status method works, but Get_House_Security_Status1 method doesn't work. Why ?

Thanks in advance, regards, Rob.
sub Get_House_Security_Status { my ($self)= @_; $self->{House_Security_Status} = $self->Sql_Query("select * from p +luto_security.ModeChange order by psc_mod DESC limit 0,1",'EK_HouseMo +de'); return $self->{House_Security_Status}; } sub Get_House_Security_Status1 { my ($self)= @_; $self->{House_Security_Status} = $self->Sql_Query_New("select EK_H +ouseMode from pluto_security.ModeChange order by psc_mod DESC limit 0 +,1"); } sub Sql_Query { my ($self, $sql_statement, $sql_field)= @_; my $statement = $self->{SQL_Connector}->prepare($sql_statement); $statement->execute(); return $statement->fetchrow_hashref()->{$sql_field}; } sub Sql_Query_New { my ($self, $sql_statement)= @_; my $statement = $self->{SQL_Connector}->prepare($sql_statement); $statement->execute(); return $statement->fetchrow_hashref(); } my $Security_Status = $LMCE->Get_House_Security_Status(); my $Security_Status1 = $LMCE->Get_House_Security_Status1(); DBD::mysql::st execute failed: You have an error in your SQL syntax; c +heck the manual that corresponds to your MySQL server version for the + right syntax to use near '(0x84195cc)' at line 1 at LMCE_Connector.p +m line 218.

In reply to Simple sql query problem by Anonymous Monk

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.