> I've created a subrutine to acces DB, but while sending the Query it get an > error. > > My function looks like: > > sub DbSqlQuery > { > local $str_query = @_ if @_;
(Why are you using local? 'local' is deprecated in favor of 'my'.) $str_query is a scalar, @_ is an array. Putting a scalar on the left of an assignment forces the assignment to be scalar context--and in scalar context the array returns the number of elements (1 in this case). Try something more like: my $str_query = $_[0]; -- or -- my $str_query = shift @_; # grabs first element of @_ array > print $str_query; > <... blah, blah ..> > } > > And my program call it like: > > <... blah, blah ..> > $str_Query = "SELECT admin_ID, admin_name FROM admins WHERE (admin_login = > '$str_Login'); > print "Content-type: text/plain\n\n TEST: $str_Query :: \n"; > &DbSqlQuery($str_Query); > <... blah, blah ..> > > > When I run, I get the following output: > > SELECT admin_ID, admin_name FROM admins WHERE (admin_login = 'my value') :: 1 > ERROR: 1 > 1064 (You have an error in your SQL syntax near '1 ' at line 1) > > > > > Where it comes the '1'? > > I must use pointers or similar? > > > > -- > > > saludos, > > > J. Alejandro Ceballos Z. | > ---------------------------+--------------------------- > http://alejandro.ceballos.info | > [EMAIL PROTECTED] | "Las batallas contra las mujeres > -------------------------------+ son las únicas que se ganan huyendo". > | > | -- Napoleon Bonaparte. > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > -------------------------------------------------------------- "I'll say this about Linux: it's the first time I've seen Unix on the right platform."--Steve Ballmer, president of Microsoft (NB: Microsoft used to own SCO, which did, and still does, produce a Unix for the Intel platform.) -------------------------------------------------------------- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>