<?php
$sTable = "mytable";
$colUpdate = $_GET['field'];// database field name
$valUpdate = $_GET['val']; // the long string ,can be non-English
$rowID = $_GET['id']; //number
$pdo = PDO2::getInstance();
$pdo->exec('SET NAMES utf8'); // for utf-8
$sql = "UPDATE $sTable
SET $colUpdate =:valUpdate
WHERE id =:rowID ";
$req = $pdo->prepare($sql);
$req->bindValue(":valUpdate", $valUpdate);
$req->bindValue(":rowID", $rowID);
$req->execute();
$req->closeCursor();
?>
私はここで何を間違えましたか?
<?php
$sTable = "mytable";
$pdo = PDO2::getInstance();
$colUpdate = $_GET['field'];
$valUpdate = $_GET['val'];
$rowID = $_GET['id'];
$sQuery = " UPDATE $sTable SET $colUpdate = '$valUpdate' WHERE id = $rowID";
$req = $pdo->prepare($sQuery);
$req->execute();
$req->closeCursor();
?>