好吧我收到错误调用未定义的方法MyDbCon而我是新手所以请帮助我,我在这里做错了什么?温柔哈哈
use Zend\Db\Sql\Select;
function getStudentsByMst(&$response,$mst_id,$stud_id=true,$now=true)
{ if(!ctype_digit($mst_id))
{ $response = array(
'code' => HTTP_Status::BAD_REQUEST,
'message' => 'Registration ID cannot be digits only'
);
return false;
}
}
include_once('credentials.db.php');
if(empty($_POST['stud_id']) == FALSE)
{
$barcode = htmlentities($_POST['stud_id']);
//checking if the barcode exist in the database
$dbh=new MyDbCon;
$barcode_check = $dbh->query("select * from usats where stud_id='$stud_enrolmentno'");
//extracting the status of the item
if($barcode_check->rowCount() > 0)
{
while($row = $barcode_check->fetch(PDO::FETCH_OBJ))
{
$presence = $row->presence;
}
}
if($barcode_check->rowCount() > 0 && $presence == '1')
{
//updating the database table barcode for student presence/absence
$addAttd = $dbh->exec("UPDATE usats SET status='0' where stud_id= '$stud_enrolmentno'");
if($addAttd > 0)
{
echo "<script> alert('Successful');</script>";
}
}
}
?>