user9703306
user9703306

Reputation: 9

how to remove leading zero from mysql column value in codeigniter

how to remove leading zero from MySQL column value in codeigniter. which is use in where condition.Thanks in Advance

Query syntax is below, delivery_order_no can be 0001

$this->db->where("delivery_order_no","1");

Upvotes: 0

Views: 232

Answers (2)

Adesh Gupta
Adesh Gupta

Reputation: 11

You can use intval() function

    $string= '0021';
$this->db->where("delivery_order_no",intval($string));

Upvotes: 1

Barmar
Barmar

Reputation: 781058

Convert delivery_order_no to an integer, that will remove leading zeroes.

$this->db->where("0 + delivery_order_no = $id");

Upvotes: 0

Related Questions