fdsa fdsa - 2 years ago 64
PHP Question

How do I put booleans into a mysql database with prepared statements?

According to the PHP manual, the four variable types for


  1. integer,

  2. double,

  3. string and

  4. blob.

What is the best way to insert a boolean?

Answer Source

Mysql doesn't really store booleans anyway, it's a trick.

The actual format is TINYINT, which is I guess integer for pdo.

You will have to convert true/false to 1/0, with boolval for example.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download