我的脚本有问题。我收到此错误:致命错误:无法访问空属性
代码是:
public function insertap()
{
try
{
//echo $_POST['tranzactie'].$_POST['tip'].$_POST['tip_loc'].$_SESSION['uid'];
$stmt=$this->$dbh->beginTransaction();
$sql="INSERT INTO `anunturi` (`tranzactie`, `tip`, `tip2`, `user`) VALUES (:tranz, :tip, :tip_loc, :user)" ;
$stmt->prepare($sql);
$data = array('tranz' => $_POST['tranzactie'], 'tip' => $_POST['tip'], 'tip_loc'=>$_POST['tip_loc'], 'user'=>$_SESSION['uid']);
$stmt->execute($data);
$stmt->commit();
}
catch (Exception $e)
{
$stmt->rollback();
echo "A aparut o eroare";
}
}
提前致谢...