kidd has asked for the wisdom of the Perl Monks concerning the following question:
Hello...
Im having some problems with adding info to mySQL database..
Here is the code that inputs the information to the database:
$dbh = BaboonDB->connect(); $sth = $dbh->prepare('INSERT INTO anuncios (usuario,titulo,mensaje, +categoria,estado,pais,imagen,image_align,expiracion,firma) VALUES(?,? +,?,?,?,?,?,?,?,?)') or die("Couldn't prepare statement: " . $dbh->err +str); $sth->execute($user,$title,$msg,$cat,$state,$country,$img,'left',$e +xpiration,$name) or die("Couldn't execute statement: " . $sth->errstr +); $dbh->disconnect;
The problem resides in the variable $msg that has this value: tengo todo por aprender ¿quien quiere enseñarme?
The problem I figured out is the ? that conflicts with the prepare statement.
I tried to escape it with something likes this: $msg = $dbh->quote($msg);
But without success...can anyone tell me how can I safely escape the ?
By the way...Im using the DBD::mySQL module...
Thanks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: mySQL Query Problem
by gmax (Abbot) on Feb 11, 2003 at 21:01 UTC | |
by kidd (Curate) on Feb 12, 2003 at 15:17 UTC | |
Re: mySQL Query Problem
by adrianh (Chancellor) on Feb 11, 2003 at 17:02 UTC | |
Re: mySQL Query Problem
by bart (Canon) on Feb 11, 2003 at 17:53 UTC | |
Re: mySQL Query Problem
by jammin (Novice) on Feb 11, 2003 at 17:57 UTC | |
Re: mySQL Query Problem
by Jazz (Curate) on Feb 13, 2003 at 02:42 UTC | |
by kidd (Curate) on Feb 13, 2003 at 12:58 UTC | |
by adrianh (Chancellor) on Feb 14, 2003 at 08:51 UTC |
Back to
Seekers of Perl Wisdom