Couple things.. note that this:
substr($est_code,0,1) != '0'
could be reduced to this:
$est_code[0] != '0'
And also note that doing this in PHP is altogether unnecessary; why loop through each row individually, retrieve its contents, use PHP to determine if it needs to change, make the change, and then replace the row's contents? Why not simply let the SQL server take care of it for you, e.g.:
UPDATE myTable
SET theColumn = CONCAT('0', theColumn)
WHERE LEFT(theColumn, 1) != '0'