1

I am using Angular2(typescript), Slim and Mysql.

Mysql can store boolean only in 0/1 tinyint. However can't convert 1/0 to boolean.

Is the best way to convert it intro true/false string before send? Any ideas?

J. Chomel
  • 8,193
  • 15
  • 41
  • 69
AndersonDev
  • 83
  • 1
  • 1
  • 8
  • use a case/when or `if()` – Drew Jul 25 '16 at 11:01
  • 2
    [Cast it in PHP](http://php.net/manual/en/language.types.type-juggling.php); e.g: `$myBoolean = (bool) $myTinyInt;`. Post an example of your code if you want a more specific example. – Darragh Enright Jul 25 '16 at 11:04
  • 1
    I have a class in typescript with boolean row: `export class Callback { public phone: string; public isCalled: boolean; }` However mysql store boolean in 1/0. When I get array of Callback angular .json() can't convert 0/1 and true/false as well in boolean field – AndersonDev Jul 25 '16 at 12:32

0 Answers0