On Thu, May 29, 2003 at 11:17:40AM +0200 anthony wrote:

> i have to update a MySQL tables some names and text
> the problem is that the names and words have quotes
> maybe in names it has O'connor, and text would be
> He said  :"I'don't know where to go!!".
> 
> where there is a mixture of single and double quotes in text, i'm really get
> problem with updating the table.
> any help with the query statment would be appreciated!!
> also I forgot to mention I tried
> $name = $dbh->("$name");
> $text   = $dbh->("$text");
> I get an error it says it is not a CODE.**and i use $dbh to connect to
> database, so it is valid**

I am hardly surprised. Where did you pick the above up? $dbh is not a
code-reference (in which case it would indeed be called as you did). I
suppose it's a database-handler. 

As for quoting, the DBI module can do that for you. You first prepare a
statement and get back a statement-handler on which you then call
execute with the data to be inserted, queried etc. For instance:

    my $sth = $dbh->prepare("UPDATE table SET name=? where ID=?");
    $sth->execute($name, $id);

The two parameters to execute() ($name and $id) directly correspond to
the two question-marks in the prepare-statement. If you expand it, this
would read:

    UPDATE table SET name=$name where ID=$id

but $name and $id get properly quoted so that you don't have to care
about that.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to