my $hour_master_db = DBI->connect("DBI:mysql:database=$database;host=$ +host;mysql_socket=/opt/lampstack-5.5.27-0/mysql/tmp/mysql.sock","root +","", {'RaiseError' => 1}); my $hour_insert_sth = $hour_master_db->prepare("insert into esme_hourl +y_master values(?,?,?,?,?,?,?,?,?,now(),'MIS'"); $hour_insert_sth->execute($hr,$date,$system_id,$total_sub_data{$statsd +ate}{$system_id},$totalacpt_data{$statsdate}{$system_id},$total_rej_d +ata{$statsdate}{$system_id},$del_data{$statsdate}{$system_id},$undel_ +data{$statsdate}{$system_id},$exp_data{$statsdate}{$system_id}) or di +e $DBI::errstr;
This is the code I am using to insert data into mu DB. But its showing error
But when I print data its showing perfectly like 09,2015-11-03,uni_upe,499887,466649,33238,0,0,0 I think I have to add ' ' to uni_upe which is a string. But how can I?? Or is there any other mistake???DBD::mysql::st execute failed: You have an error in your SQL syntax; +check the manual that corresponds to your MySQL server version for th +e right syntax to use near '' at line 1 at final.pl line 328. 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 '' at line 1 at final.pl line 328.
My DB schema
+---------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+-------------+------+-----+---------+-------+ | hour | int(2) | NO | PRI | NULL | | | day | date | NO | PRI | NULL | | | system_id | varchar(21) | NO | PRI | | | | submitted | bigint(20) | NO | | 0 | | | accepted | bigint(20) | NO | | 0 | | | rejected | bigint(20) | NO | | 0 | | | delivered | bigint(20) | NO | | 0 | | | undelivered | bigint(20) | NO | | 0 | | | expired | bigint(20) | NO | | 0 | | | creation_date | datetime | NO | | NULL | | | created_by | varchar(20) | NO | | | | +---------------+-------------+------+-----+---------+-------+ 11 rows in set (0.00 sec)
In reply to $hour_insert_sth->execute showing error by ravi45722
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |