LoginSignup
2
2

More than 5 years have passed since last update.

MySQLのBIT型にPHPのPDOが対応していない問題のWorkaround

Posted at

BIT型のリテラルだけ、変数に置くのはどうでしょうか。

test.php
$db->exec("SET @val = 0b0011");
$stmt = $db->prepare("UPDATE SET column = @val WHERE id = :id");
$stmt->bindValue(':id', 123);
$stmt->execute();
2
2
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2