致命错误:未捕获错误:调用未定义的方法PDO :: execute(),堆栈跟踪:抛出#0 {main}

时间:2019-02-23 15:34:44

标签: php mysql pdo xampp

我只是想知道以下代码中的错误是什么?

<?php
$hostname = "localhost";
$database = "db_tarp_proj";
$username = "root";
$password = "";

try
  {
   $conn = new PDO("mysql:localhost=$hostname,dbname=$database","$username","$password");
   $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

   $modal_fullname = $_POST['fullname'];
   $modal_username = $_POST['username'];
   $modal_password = $_POST['password'];
   $modal_email = $_POST['emailaddress'];
   $modal_designation = $_POST['designation'];

   $sql = $conn->prepare("INSERT INTO tbl_bckend_user (fullname, username, password, emailaddress, insrt_designation)
   VALUES (?, ?, ?, ?, ?)");

在这一行中我有一个错误

 $conn->execute(array($modal_fullname->insrt_fullname, $modal_username >insrt_username, $modal_password->insrt_password, $modal_email->insrt_email, $modal_desig->insrt_designation));

在这里结束

   //$conn->execute($sql);
   echo "New Record Created Successfuly!";
   }
   catch(PDOException $e)
   {
    echo $sql . "<br>" . $e->getMessage();
   }
    $conn = null;
       //header("location:/tarp_admin/dashboard.php")
   ?>

我还安装了一个php_pdo.dll,我的xammp版本是7.3.2。你们能帮帮我吗?我很绝望。谢谢!

0 个答案:

没有答案