I have a table like this:
// numbers
+---------+------------+
| id | numb |
+---------+------------+
| int(11) | bit(10) |
+---------+------------+
| 1 | 0000000001 |
| 2 | 0000000101 |
| 3 | 0000000000 |
| 4 | 0000001011 |
+---------+------------+
When I fetch numb column, the result will be like this:
// Query
mysql> SELECT numb FROM numbers WHERE id = 2
// Fetching by PHP (pdo)
$result = $stm->fetch();
$numb = $result['numb'];
echo $numb;
//=> 5
As you see, the final result is 5. While I want to get that exact value as a string, like this 0000000101. How can I do that?
12=>1100,26=>11010. While I want to get a binary number based 10.