Hi there!

I'm currently trying to customize Bugzilla. I now know where I need to add code in order to achieve the changes I need, but dbh seems to behaving a problem with an @ sign I'm using.

Here's the code:

my $user_login_name = 'name.surname@company.com'; my $sth = $dbh->prepare("SELECT userid, login_name, realname FROM prof +iles WHERE login_name=$user_login_name"); $sth->execute(); while(my @zeile_user = $sth->fetchrow_array()) { $user_id_custom = $zeile_user[0]; $login_name_custom = $zeile_user[1]; $realname_custom = $zeile_user[2]; }

The error I get is:

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 '@company.com' at line 1 [for Statement "SE +LECT userid, login_name, realname FROM profiles WHERE login_name=name +.surname@company.com"] at C:/Bugzilla/buglist.cgi line 1079

I thought if I pass the login_name in '' it would work, but it's not. I'm sorry if this is a stupid question. I'm new to perl (coming from PHP) and this all very confusing for me :-(

Maybe someone could enlighten me a bit as to what I'm doing wrong?

Cheers

Fred

In reply to Wrong SQL Syntax? by Frederic_S

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.