【发布时间】:2017-07-05 06:58:42
【问题描述】:
嘿,
我需要一个 php 函数来检查表单输入的值是否已经在数据库中(sql - server - PDO),并返回 TRUE 或 FALSE。
我尝试这样做,但我卡住了,在互联网上没有找到解决方案。 你能告诉我如何威胁上述条件吗?
function check_code($code) {
GLOBAL $handler;
$code = check_input($code);
try{
$query2 = $handler -> prepare("SELECT code from stock where code = :code");
$query2 -> execute(array(
':code' => $code
));
return >???<
}
catch(PDOException $e){
echo $e -> getMessage();
} }
【问题讨论】:
标签: php sql-server pdo