0
我正在从mysql_connect切换到pdo,无法启动。这里是我的代码:pdo准备好的声明不起作用
//get the row sk
$sk = strtok($string, "_");
//get the column name (the rest of the $string)
$column_name = substr($string, strpos($string, "_") + 1);
//get the value
$value = $_SESSION['save_arr'][$string];
echo "{$column_name} {$value} {$sk}</br>";
$sql = "update tbl_brand set ?=? where brand_sk=?";
$q = $pdo_conn->prepare($sql);
$q->execute(array($column_name, $value, $sk));
,如果我硬编码在某些值,那么它工作正常
$sql = "update tbl_brand set name_long='name' where brand_sk='1'";
我敢肯定,这只是一个语法问题,但我无法看到它。我工作过这个例子http://www.phpeveryday.com/articles/PDO-Error-Handling-P552.html
从回声的结果是,像这样:
NAME_LONG国家Autjho玻璃2
你是一个救星人:)我认为这将会是类似的东西傻......我会选择为最佳答案在5分钟内它会让我 –