cdherold has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to do what I thought was some pretty simple stuff, but I got thwarted by my lack of knowledge!
I'm trying to write a variable into a database.
But this variable has single quotes and it won't go.
Is there some sort of "quote" hierarchy that I don't know about ... for instance, could I use [] as quotes, () don't seem to work.
My current code is below. It works for putting strings into the database like 123, but not for stuff with quotes.
Any tips?
$trend= "<img src='images/down.jpg'>"; $sth_2 = $dbh->prepare("UPDATE options SET trend=$trend WHERE ticker = + '$ticker';"); $sth_2->execute();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Writing to DB with quotes
by davidrw (Prior) on Jun 29, 2006 at 00:01 UTC | |
by lhoward (Vicar) on Jun 29, 2006 at 12:12 UTC | |
Re: Writing to DB with quotes
by madbombX (Hermit) on Jun 29, 2006 at 01:37 UTC | |
Re: Writing to DB with quotes
by Moron (Curate) on Jun 29, 2006 at 11:59 UTC | |
Re: Writing to DB with quotes
by Anonymous Monk on Jun 29, 2006 at 13:54 UTC |