以下语句在执行时会出错:
$stmt=$db->prepare ("INSERT INTO cabs (NAME,IDNO,HOSTEL,MODE,DATE,TIME,TFNO,CONTACT)
VALUES
(:name,:idno,:hostel,:mode,:date,:time,:tfno,:contact)");
$stmt->bindParam (':name',$_POST[name]);
错误陈述:
Fatal error: Call to a member function bindParam() on a non-object in C:\wamp\www\overflow\rew1.php on line 27
答案 0 :(得分:1)
添加'
$stmt=$db->prepare ("INSERT INTO cabs (NAME,IDNO,HOSTEL,MODE,DATE,TIME,TFNO,CONTACT)
VALUES
(:name,:idno,:hostel,:mode,:date,:time,:tfno,:contact)");
$stmt->bindParam (':name',$_POST[name], PDO::PARAM_STR);
上的示例