From: Daniel Koch Date: March 19 1999 11:23pm Subject: Re: Perl/Mysql problems List-Archive: http://lists.mysql.com/mysql/654 Message-Id: <36F2DC61.D277E7FC@amcity.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit "Robert H. Clugston" wrote: > Dear List, > I'm using Perl to write the my database. To avoid problems when inserting > rows into my table I use the perl \Q\E method to escape all characters. > Below is my query: > > $query = 'INSERT into messages VALUES("' . "\Q$name\E" . '", "' . > "\Q$email\E" . '", "' . "\Q$d > ate\E" . '", "' . "\Q$subject\E" . '", "' . "\Q$message\E" . '", "' . > "\Q$id\E" . '")'; > > Ever since updating to Debian 2.1 when ever I insert a "?" a null character > is inserted in its place. In Debian 2.1 I believe the Mysql server version > is 3.21.33b. > DBI is interpreting the ? as a placeholder, and inserting a NULL in its place. Code like this is cleaner, and will solve your problem: my $query = q( INSERT into messages VALUES(?, ?, ?, ?, ?, ?) ); my $sth = $dbh->($query); $sth->execute($name, $email, $date, $subject, $message, $id); DBI takes care of all the quoting for you. Dan -- Daniel Koch American City Business Journals http://www.amcity.com/