我正在尝试检查该值是否存在于数据库中的代码。我的代码是:
$registration_code = $_POST['registration_code'];
$registration_code = mysql_real_escape_string($registration_code);
$checkcustomer = mysql_query("SELECT `customer_no` FROM customer WHERE registration_code = '$registration_code'");
echo $checkcustomer;
if (!$checkcustomer) {
echo "<script language=javascript>alert('Please enter a valid Registration code.')</script>";
}
else{
// some php code
}
而不是返回客户编号。,当我回$checkcustomer
显时,我的查询返回“资源 id #19”。有人可以帮我吗????