致命错误:未捕获的异常' PDOException'消息' SQLSTATE [42000]:,sql

时间:2016-12-08 21:09:11

标签: php mysql sql

你好这里是导入类别的代码,但是有些不好

error: 

致命错误:未捕获的异常' PDOException' with message' SQLSTATE [42000]:语法错误或访问冲突:1064 SQL语法中有错误;查看与您的MariaDB服务器版本对应的手册,以获得正确的语法,以便在' kategorijos(name,desc,ordering,visibility,allowcomm,allowads)附近使用VALUES(['在第2行'在/中home / u410366608 / public_html / admin / categories.php:136堆栈跟踪:#0 /home/u410366608/public_html/admin/categories.php(136):PDOStatement->执行(数组)#1 {main}抛出/ home / u410366608 / public_html / admin / categories.php第136行

代码:`elseif($ do ==' Insert'){

        if ($_SERVER['REQUEST_METHOD'] =='POST') {

            echo "<h1 class='text-center'>Prideti kategorija.</h1>";
            echo "<div class='container'>";

            $name       = $_POST['name'];
            $desc       = $_POST['description'];
            $order      = $_POST['ordering'];
            $visible    = $_POST['visibility'];
            $comment    = $_POST['commenting'];
            $ads        = $_POST['ads'];            

            $check = checkItem("name", "kategorijos", $name);

                if ($check == 1) {
                    echo "<div class='container'>";
                    $theMsg = '<div class="alert alert-danger">Tokia kategorija jau yra.</div>';
                    redirectHome($theMsg, 'back' );
                    echo "</div>";
            }

            else {

                $stmt = $con->prepare("INSERT INTO kategorijos(name, desc, ordering, visibility, allowcomm, allowads)
                VALUES([:zname], [:zdesc], [:zorder], [:zvisible], [:zcomment], [:zads])");

                $stmt->execute(array(

                    'zname'     => $name,
                    'zdesc'     => $desc,
                    'zorder'    => $order,
                    'zvisible'  => $visible,
                    'zcomment'  => $comment,
                    'zads'      => $ads



                ));

                echo "<div class='container'>";
                $theMsg = "<div class='alert alert-success'>" . $stmt->rowCount() . 'Kategorija prideta.</div>';
                redirectHome($theMsg, 'back' );
                echo "</div>";
            }


    }

            else {
                echo "<div class='container'>";

                $theMsg = '<div class="alert alert-danger">Neturite siam puslapiui teisiu.</div>';
                redirectHome($theMsg, 'back');

                echo "</div>";

                }
            echo "</div>";


        }`

请帮助

0 个答案:

没有答案