[英]What's the equivalent of escaping strings for MySQL database input in Perl?
在perl中,MySql数据库输入的转义字符串相当于什么?
引用最好的方式?
这是一个例子(来自此链接 ):
#! /usr/bin/perl
use DBI;
print "Enter the city you live in: ";
chomp( $city = <STDIN> );
print "Enter the state you live in: ";
chomp( $state = <STDIN> );
$dbh = DBI->connect(your db info here);
$sth = $dbh->prepare( "SELECT name WHERE city = ? AND state = ?" );
$sth->execute( $city, $state );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.