繁体   English   中英

在Perl中,MySQL数据库输入的转义字符串相当于什么?

[英]What's the equivalent of escaping strings for MySQL database input in Perl?

在perl中,MySql数据库输入的转义字符串相当于什么?

引用最好的方式?

您可以使用DBI 占位符

这是一个例子(来自此链接 ):

#! /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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM