mysql_connect から 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 ナショナル オーチョ グラス 2