I have a simple table as follow:
mysql> describe mytest1;
+--------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------+------+-----+---------+-------+
| mytime | timestamp(6) | YES | | NULL | |
| abc | varchar(8) | YES | | NULL | |
+--------+--------------+------+-----+---------+-------+
if I insert record by perl script with statement like this:
my $sth = $dbh->prepare("insert into mytest1 values (\"011011\",\"test\")") or die
"Can't prepare statement: ".$dbh->errstr;
the record can be inserted. But if I use variable
$data1="011011";
$data2="test";
and insert as
my $sth = $dbh->prepare("insert into mytest1 values ($data1,$data2)") or die "Can't
prepare statement: ".$dbh->errstr;
I got this error:
DBD::mysql::st execute failed: Unknown column 'test' in 'field list' at ./select
1.pl line 7.
I have done numerous tests and found that if I change the $data2 to a numeric, it can
inserted.
barry
--
_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup
Have you downloaded the latest calling software from Net2Phone? Click here to get it
now!
http://www.net2phone.com/cgi-bin/adforward.cgi?p_key=NH211JK&url=http://commcenter.net2phone.com/