PDO INSERT警告:PDOStatement :: execute()[pdostatement.execute]:SQLSTATE [HY093]:参数号无效:参数未在

时间:2013-07-16 18:43:27

标签: php sql pdo sql-insert

当我运行此代码时:

$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]:参数号无效:参数未在C:\ wamp \ www \ pcqsp-scratch \ admin.php中定义82

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

你对此有任何想法吗?谢谢:))

0 个答案:

没有答案