This is kind of an odd question, and I may even be doing something wrong that I am not aware of, but I am trying to use variables in a DBI do query for example:
When I try to run my script I get this error from DBI: DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',)' at line 1 at hal9000.pl line 154, <$csvfile> line 2. Looking at my query I don't see where a rouge comma would be coming from. My reason for trying to do this is because I need to read data from multiple files and insert parts of it into a MySQL database. The order that the data is in differs between files so instead of trying to maintain a DBI do query for each file I would rather have one dynamic DBI query if possible.my $columns = 'name,date'; my $values = 'Ben Marcata,2001-05-04'; my $placeholders = '?,?'; $dbh->do("insert into foo (source, $columns, status) values ($placehol +ders)", {}, 'file', $values, '' );
In reply to Using variables in a DBI do queriy by vendion
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |