Reputation: 9
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
Reputation: 11
You can use intval() function
$string= '0021';
$this->db->where("delivery_order_no",intval($string));
Upvotes: 1
Reputation: 781058
Convert delivery_order_no
to an integer, that will remove leading zeroes.
$this->db->where("0 + delivery_order_no = $id");
Upvotes: 0