0

当我运行此代码时:

$req = $conn->query('SELECT max(id_work) FROM work');
$res = $req->fetchColumn();
$current_id = $res['id_work'];

$desired_dir="images/work/" . $max . "-" . $_POST['title'] . "/";

$req = $conn->prepare('INSERT INTO screenshot(link_screenshot, id_work) 
                              VALUES (:link, :id_work)');
$req->execute(array(
                    'link_screenshot' => $desired_dir . "/" . $file_name,
                    'id_work' => $current_id));  //Line where I get from the error

我收到此错误:

警告:PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in C:\wamp\www\pcqsp-scratch\admin.php on line 82

第 82 行:'id_work' => $current_id));

你对此有什么想法吗?谢谢 :)

4

0 回答 0