in reply to Re^2: Not able to insert data in mysql
in thread Not able to insert data in mysql
Ok, let's take it from the beginning because there are a few things worth mentioning here.
Fist of all for me at least, it is not clear if you are using SQL or MySQL Database.
As erix really nicely point out, maybe your SQL code was able to operate correctly without my proposed modifications that apply to MySQL syntax.
I am not a user of SQL so I am not really familiar with the syntax, and I do not have an operating system with SQL so unfortunately I can not help you a lot in case that you are not using MySQL.
I can give you a few advices that I believe that can assist you in general when you debug you database syntax.
In most cases when I get an error I take my code and I execute on MySQL terminal, or on phpMyAdmin for testing purposes.
I am following this prosedure until I found the correct syntax, so when I will call the function through my Perl script I know that it will do what I am expecting it to do.
I assume that SQL has similar tools to check the syntax of your code.
I noticed also that your updated code:
my $sth = $dbh->prepare(qq{INSERT INTO 'tutpoint_tbl'('tut_id','tut_ti +tle','tut_author') VALUES(?,?,?)});
Contains (') single quotes, which on MySQL syntax is not correct, I do not know about SQL.
On my previous post I tried to "describe" why I proposed to use (`) backticks and (") double quotes on your MySQL, be carefull maybe the same syntax not apply on SQL. Maybe my explanation was not well defined so, I found this really simple tutorial quotes in Perl that explains with examples the use of single and double quotes. In all programing languages you will use them very often so it would be beneficial to understand how to use them correctly and when to use which.
Finalizing, as everyone correctly proposed I think your code is not even reaching the database syntax, probably the error is somewhere higher at your code.
XML is a bit tricky you need to find a way to debug your code step by step.
Hope this long answer will give you a good start and help you to continue.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Not able to insert data in mysql
by Anonymous Monk on May 11, 2014 at 18:59 UTC |