Php 致命错误:未捕获PDO异常:SQLSTATE[HY093]:无效参数编号:

Php 致命错误:未捕获PDO异常:SQLSTATE[HY093]:无效参数编号:,php,Php,我知道有很多问题是相似的,但没有一个能解决我的问题。我正在将多张图片上载到我的数据库。我没有直接上传到数据库。我正在存储到一个文件夹中。这是我的php代码 <?php include('database.php'); if(!empty($_FILES['physics(class8)']['name']) && (!empty($_FILES['chemistry(class8)']['name']))){ // file attribute $fil

我知道有很多问题是相似的,但没有一个能解决我的问题。我正在将多张图片上载到我的数据库。我没有直接上传到数据库。我正在存储到一个文件夹中。这是我的php代码

<?php

include('database.php');

if(!empty($_FILES['physics(class8)']['name']) && (!empty($_FILES['chemistry(class8)']['name']))){
    // file attribute
    $filename=$_FILES['physics(class8)']['name'];
    $filesize=$_FILES['physics(class8)']['size'];
    $filetype=$_FILES['physics(class8)']['type'];

    $filename1=$_FILES['chemistry(class8)']['name'];
    $filesize1=$_FILES['chemistry(class8)']['size'];
    $filetype1=$_FILES['chemistry(class8)']['type'];

    $filename2=$_FILES['maths(class8)']['name'];
    $filesize2=$_FILES['maths(class8)']['size'];
    $filetype2=$_FILES['maths(class8)']['type'];


    $filename3=$_FILES['biology(class8)']['name'];
    $filesize3=$_FILES['biology(class8)']['size'];
    $filetype3=$_FILES['biology(class8)']['type'];

    $filename4=$_FILES['english(class8)']['name'];
    $filesize4=$_FILES['english(class8)']['size'];
    $filetype4=$_FILES['english(class8)']['type'];


    #server directory where the file will get uploaded
    #create a directory first

    if($filetype!="image/jpg" && $filetype!="image/png" && $filetype!="image/jpeg")
     {
        echo '<script> alert("Olny jpg , jpeg and png extenstions are allowed")</script>';
    }

    else if(($filesize>="2097152") && ($filesize1>="2097152") )
    {
        echo '<script> alert("image less than 2mb are allowed")</script>';
    }



    else{
        $serverpath="class 8/physics/".rand(000,999).$filename;
        $serverpath1="class 8/chemistry/".rand(000,999).$filename1;
        $serverpath2="class 8/maths/".rand(000,999).$filename2;
        $serverpath3="class 8/biology/".rand(000,999).$filename3;
        $serverpath4="class 8/english/".rand(000,999).$filename4;

        # file upload
        $tmp_file = $_FILES['physics(class8)']['tmp_name'];
        $tmp_file1 = $_FILES['chemistry(class8)']['tmp_name'];
        $tmp_file2 = $_FILES['maths(class8)']['tmp_name'];
        $tmp_file3 = $_FILES['biology(class8)']['tmp_name'];
        $tmp_file4 = $_FILES['english(class8)']['tmp_name'];

        #move the temp file
        $move=move_uploaded_file($tmp_file, $serverpath) or die ($_FILES['physics(class8)']['error']);
        $move1=move_uploaded_file($tmp_file1, $serverpath1) or die ($_FILES['chemistry(class8)']['error']);
        $move2=move_uploaded_file($tmp_file2, $serverpath2) or die ($_FILES['maths(class8)']['error']);
        $move3=move_uploaded_file($tmp_file3, $serverpath3) or die ($_FILES['biology(class8)']['error']);
        $move4=move_uploaded_file($tmp_file4, $serverpath4) or die ($_FILES['english(class8)']['error']);




        $pdoquery = "INSERT INTO `class8`(`physics(class8)`,`chemistry(class8)`,`maths(class8)`,`biology(class8)`,`english(class8)`) VALUES (:physics(class8),:chemistry(class8),:maths(class8),:biology(class8),:english(class8))";
        $pdoresult = $conn->prepare($pdoquery);
        $pdoExec = $pdoresult->execute(array(":physics(class8)"=>$serverpath,":chemistry(class8)"=>$serverpath1,":maths(class8)"=>$serverpath2,":biology(class8)"=>$serverpath3,":english(class8)"=>$serverpath4));


if($pdoExec)
 {
     echo "<script type='text/javascript'>alert('User reistration Sucessful');
     window.location='teacherdashboard.php';
     </script>";
 }

 else
 {
     echo " data not inserted";
 }


    }

}



?>

我已经检查了我的所有代码。但是没有出现任何错误。

删除所有类似于
物理(class8)
的括号,并使其类似于
物理\u class8

参数应该是简单的字符串。请去掉括号。很快,先生……但我不明白……请你标记一下好吗@艾恩伯格先生<代码>:物理(class8)对于占位符来说太复杂了。更改字符串以消除括号,例如
:physics
谢谢…它可以工作!!我的名声不到15.对不起

Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in C:\xampp\htdocs\kridha\neha.php:72 Stack trace: #0 C:\xampp\htdocs\kridha\neha.php(72): PDOStatement->execute(Array) #1 {main} thrown in C:\xampp\htdocs\kridha\neha.php on line 72