页面中的jscript错误

时间:2017-05-19 17:06:44

标签: php html file-io jscript

你好我某处丢失错误,因为它没有定义抛出函数,但在其他测试文件中同样的函数工作正常。

<?php
if(isset($_GET['id']) && isset($_GET['action']) && isset($_GET['friend']))
{
    include_once "dbconnect.php";
    $act = $_GET['action'];
    $idas = $_GET['id'];
    $un = $_GET['friend'];
    $act = $DBcon->real_escape_string($act);
    $un = $DBcon->real_escape_string($un);
    $idas = $DBcon->real_escape_string($idas);
    $sql = "SELECT * FROM `friends` WHERE `pass`='$un'";
    if ($query = $DBcon->query($sql))
    {
        $row_cnt = mysqli_num_rows($query);
        if ($row_cnt != 0)
        {
            if($act == 0)
            {
                $sql2 = "DELETE FROM `gyventojai` WHERE `ID`='$idas'";
                if ($query2 = $DBcon->query($sql2))
                {
                    echo "User deleted!";
                }
                else
                {
                    echo "<script>window.parent.location = 'index.php';</script>";
                }
            }
            else if($act == 1)
            {
                $sql2 = "SELECT * FROM `users` WHERE `ID`='$idas'";
                if ($query2 = $DBcon->query($sql2))
                {
                    $uDB = $query2->fetch_array();
                    ?>
                    <html>
                        <head>
                            <script src="scripts/jquery-3.2.1.js"></script>
                            <script type="text/javascript" src="scripts/scripts.js"></script>
                        </head>
                        <body>
                            <div id="edituser">
                                <form>
                                    ID: <?php echo $uDB[0]; ?><br>
                                    Nick:<input type="text" id="nick" value="<?php echo $uDB[1]; ?>" required>
                                    <br>
                                    Log id ID:<input type="text" id="logid" value="<?php echo $uDB[2]; ?>" required>
                                    <br>
                                    <input type="hidden" id="friend" value="<?php echo $un; ?>">
                                    <input type="hidden" id="oldname" value="<?php echo $uDB[1]; ?>">
                                    <input type="hidden" id="id" value="<?php echo $uDB[0]; ?>">
                                    <button type="button" onclick="saveuser()" id="save_btn">Save</button>
                                </form>
                            </div>
                            <div id="respond"></div>
                        </body>
                    </html>
                    <?php
                }
                else
                {
                    echo "<script>window.parent.location = 'index.php';</script>";
                }
            }
            else
            {
                echo "<script>window.parent.location = 'index.php';</script>";
            }
        }
        else
        {
            echo "<script>window.parent.location = 'index.php';</script>";
        }
        $query->close();
    }
    else
    {
        echo "<script>window.parent.location = 'index.php';</script>";
    }
}
else
{
    echo "<script>window.parent.location = 'index.php';</script>";
}
?>

感谢您的帮助!代码在id = edituser的地方不起作用,其中createuser函数抛出了未定义createuser的错误。

0 个答案:

没有答案