这是我在另一个.php文件中调用的check.php文件 发书。另外,我还有另一个代码,当我输入ISBN号时,自动显示书名没有问题。
<?php
require_once("includes/config.php");
if(!empty($_POST["bookid"])) {
$bookid=$_POST["bookid"];
$sql ="SELECT BookQuantity,id FROM tblbooks WHERE (ISBNNumber=:bookid)";
$query= $dbh -> prepare($sql);
$query-> bindParam(':bookid', $bookid, PDO::PARAM_STR);
$query-> execute();
$results = $query -> fetchAll(PDO::FETCH_OBJ);
$cnt=1;
if($query -> rowCount() > 0)
{
foreach ($results as $result) {?>
<?php
if($BookQuantity == 0)
{
echo"<b>AVAILABLE</b>";
}
else
{
echo"<b>Not Available</b>";
}
echo "<script>$('#submit').prop('disabled',false);</script>";
}
}
else{?>
<option class="others"> Invalid Reference Number</option>
<?php
echo "<script>$('#submit').prop('disabled',true);</script>";
}
}
?>