【发布时间】:2019-03-05 05:45:41
【问题描述】:
我的网页出现以下错误致命错误:无法使用 try without catch 或 finally 在第 13 行的 apply-for-job.php 中,我我自己找不到错误请求我需要帮助谢谢。下面是我的代码:-
<?php
include 'connect.php';
if(isset($_POST['apply']))
{
$fname = $_POST['firstname'];
$mname = $_POST['middlename'];
$lname = $_POST['lastname'];
$city = $_POST['city'];
$state = $_POST['state'];
$education = $_POST['education'];
$vaccancy = $_POST['position'];
try{
$stmt = $db_con->prepare('INSERT INTO tbl_employment(firstName,middleName,lastName,userCity,userState,userEducation,userPosition) VALUES (:fname, :mname, :lname, :ucity, :ustate, :uedu, :uvacca)');
$stmt->bindParam(":fname", $fname);
$stmt->bindParam(":mname", $mname);
$stmt->bindParam(":lname", $lname);
$stmt->bindParam(":ucity", $city);
$stmt->bindParam(":ustate", $state);
$stmt->bindParam(":uedu", $education);
$stmt->bindParam(":uvacca", $vaccancy);
if ($stmt->execute())
{
$message="success";
}
else{
$message="error";
}
}
}
?>
我的第 13 行位于 try{ 所在的位置
【问题讨论】:
-
错误信息不是那么含糊。任何
try块至少需要一个catch或finally,您应该在第30 行之后添加其中一个。 -
你知道
try的目的是什么吗?
标签: php