Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: DBI Query insert issue....

by kennethk (Abbot)
on Jul 03, 2012 at 16:59 UTC ( #979746=note: print w/replies, xml ) Need Help??


in reply to DBI Query insert issue....

You could manually escape your inputs using quote (as described in DBI), but that's still a lot of interpolation and kind of a mess. Cleaner would be to use Placeholders and Bind Values. For example, if I were writing your code, it might look more like
my $sql = <<EOSQL; insert into Table ( Ticket_ID, Subject, Status, Priority, Created_Time, Queue, Owner, Class_Type, Sent_Date) values (?,?,?,?,?,?,?,?,now()); EOSQL my $query = $dbh->prepare($sql) or die $dbh->errstr; $query->execute($Ticket_ID, $Subject, $Status, $Priority, $Created_Time, $Queue, $Owner, $Class_Type, ) or die $dbh->errstr;
Also note I corrected a typo in your SQL - in the future, make sure that what you post actually compiles/runs/demonstrates your issue, as described in How do I post a question effectively?.

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Replies are listed 'Best First'.
Re^2: DBI Query insert issue....
by SriniK (Beadle) on Jul 04, 2012 at 09:36 UTC
    Hi

    Thanks for replying...
    I thought i have given enough information about my problem.
    Anyway with ur answer i have solved my problem

    Thanks
    Srinivasan
      You did give enough information in this case, but errors in posted code frequently act as red herrings, where people trying to help get confused about what's actually at issue. As well, if posted code doesn't display exactly the errors reported, many potential helpers will skip your issue. Such an error can also be inadvertently copied into a suggested solution, resulting in difficulties. And finally, I have frequently found that the act of coming up with my example code to post tracks down exactly the issue I needed help with.

      #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://979746]
help
Chatterbox?
[marto]: clever stuff
[Corion]: marto: Thanks for pointing me to Tinc - I found at least some article that suggests that what I want would be possible with Tinc. Now I can try that out :)
[marto]: I think you can do what you want without too much hassle, but yeah, please try and let me know if it works well :)
[marto]: sadly I've still not remembered the name of that x86 all in one we discussed
[Corion]: marto: Heh - I looked at the Intel things and they were all at EUR 80 or upwards, and that's a bit too much (or rather, for that money, I'd look for a NAS already)
[marto]: click bait marketing is making it harder to find stuff I can't remember based upon a few terms :(

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2018-01-17 15:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (201 votes). Check out past polls.

    Notices?