簡體   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