$UniqueID = rand(5400, 40000);
$InsertQuery = $c->prepare("INSERT INTO dbo.Users_Master (
UserUID, UserID, Pw, JoinDate, Admin, AdminLevel, UseQueue, Status, Leave, UserType, Point)
VALUES (:UserUID, :UserID, :Pw, :Date, :Admin, :AdminLevel, :UseQue, :Status, :Leave, :UserType, :Point)");
$Param = array ($UniqueID, $_POST['Username'], $_POST['Password'], '2013-21-10', 'False', '0', 'False', '0', '0', 'P', '0');
$InsertQuery->execute($Param);
こんにちは。上記のコードにはデータベースの正しい列名/テーブル名がありますが、挿入が機能しませんか?誰もが理由を見ることができますか?
私はこのクエリを10回ほど調べて、間違いを見つけようとしましたが、試すことができません。私は従来の方法でパラメータをバインドしようとしました:
$InsertQuery->bindParam(':UserUID', $UniqueID, PDO::PARAM_INT);
$InsertQuery->bindParam(':UserID', $_POST['Username'], PDO::PARAM_STR);
$InsertQuery->bindParam(':Pw', $_POST['Password'], PDO::PARAM_STR);
$InsertQuery->bindParam(':Date', '2013-21-10', PDO::PARAM_STR);
$InsertQuery->bindParam(':Admin', 'False', PDO::PARAM_STR);
$InsertQuery->bindParam(':AdminLevel', '0', PDO::PARAM_INT);
$InsertQuery->bindParam(':UseQue', '0', PDO::PARAM_INT);
$InsertQuery->bindParam(':Status', '0', PDO::PARAM_INT);
$InsertQuery->bindParam(':Leave', '0', PDO::PARAM_INT);
$InsertQuery->bindParam(':UserType', 'P', PDO::PARAM_STR);
$InsertQuery->bindParam(':Point', '0', PDO::PARAM_INT);
これも運が悪かった。