未捕获的ArgumentCountError:函数quote_smart()的参数太少,已传递1

时间:2018-07-26 07:18:20

标签: php

我有一个页面可以将任务添加到我的任务管理系统中。但出现以下错误:

  

未捕获的ArgumentCountError:函数quote_smart()的参数太少,已传递1个参数

如何解决此问题?这是我的代码:

if ($exist){
    $msg = 'Task name already exist!';
}
else{
    //unwanted HTML (scripting attacks)
    $name1 = mysqli_connect('localhost','root','','taskmanager');
    $taskname = htmlspecialchars($taskname);

    //function
    $taskname = quote_smart($taskname);

    $name1 = mysqli_connect('localhost','root','','taskmanager');
    $SQL = "INSERT INTO task_list (`taskname`, `ds`) VALUES ($taskname, '$des')";
    $result = mysqli_query($name1,$SQL);
    if($result){
        $msg = 'Task succesfully added.';
        $SQL = "CREATE TABLE $tsk (username VARCHAR(50) NOT NULL, accepted TINYINT(1) NOT NULL DEFAULT 0)";
        mysqli_query($name1,$SQL);
    }
    else{
        $msg = "Error adding task";
    }
}

1 个答案:

答案 0 :(得分:0)

quote_smart具有两个参数quote_smart($ var,$ connection);

您需要的是:

$taskname = quote_smart($taskname, $name1);

您可以在此处查看示例:https://hotexamples.com/examples/-/-/quote_smart/php-quote_smart-function-examples.html