Frederic_S has asked for the wisdom of the Perl Monks concerning the following question:
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Wrong SQL Syntax?
by moritz (Cardinal) on Dec 03, 2010 at 12:44 UTC | |
Re: Wrong SQL Syntax?
by Corion (Patriarch) on Dec 03, 2010 at 12:43 UTC | |
Re: Wrong SQL Syntax?
by McDarren (Abbot) on Dec 03, 2010 at 12:48 UTC | |
Re: Wrong SQL Syntax?
by marto (Cardinal) on Dec 03, 2010 at 12:49 UTC | |
Re: Wrong SQL Syntax?
by sundialsvc4 (Abbot) on Dec 03, 2010 at 13:28 UTC | |
Re: Wrong SQL Syntax?
by planetscape (Chancellor) on Dec 04, 2010 at 02:06 UTC | |
Re: Wrong SQL Syntax?
by kcott (Archbishop) on Dec 03, 2010 at 12:48 UTC | |
by moritz (Cardinal) on Dec 03, 2010 at 13:22 UTC | |
by herveus (Prior) on Dec 03, 2010 at 13:42 UTC | |
by Anonymous Monk on Dec 03, 2010 at 14:31 UTC | |
by kcott (Archbishop) on Dec 03, 2010 at 13:47 UTC |
Back to
Seekers of Perl Wisdom