> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Monday, December 27, 2004 12:08 PM
> To: beginners@perl.org
> Subject: Variable Value into MySQL DB
>
>
> Hi guys,
>
> I´m having kind´a problem... Here´s the deal... I´m using CGI so that the
> user can, by a browser, type the data that must be recorded into the
> database.
> I use CGI library to do that... the user type what he wants in the fields,
> and these values are sent to some variables... Then, I´d like to record
> these variables values in the db... But I just can´t get it done!
> I´m using Net::MySQL to do so... when I test the script by writing fixed
> values in it, it works fine... but when i try to record variables values
> it doesn´t work... could you help me? Here´s my code:
> #!/usr/bin/perl
> use strict;
> use CGI qw/:standard/;
>  use Net::MySQL;
> print header,
>         start_html('Cadastro de Processos'),
>         h1('Cadastramento Processos'),
>         start_form,
>         "Numero do Processo: ",textfield('process'),br,
>         "Tipo do Processo: [1-2]",textfield('type'),br,
>         "Nome do advogado: ",textfield('name'),br,
>         "Email do advogado: ",textfield('email'),br,
>         submit,
>         end_form,
>         hr,
> my $process =param(process);
> my $lawyer =param(name);
> my $email =param(email);
> my $type =param(type);
>
>   my $mysql = Net::MySQL->new(
>       database => 'tj',
>       user     => 'user',
>       password => 'pass'
>   );
>
>    $mysql->query(q{
>        INSERT INTO processo (process, name, email, type) VALUES ($process,
> $lawyer, $email, $type)
>    });

I think you have to quote the param:

my $process =param('process');
my $lawyer =param('name');
my $email =param('email');
my $type =param('type');

HTH
Ron



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to