php - loop is not showing Zero before numbers in framework -


this question has answer here:

i making form in custom framework in when user enter 2 numbers e.g start number , ending number . loop shows numbers between numbers . example if user enter 0300 , 0309 result show

0300

0301

0302

0303

0304

0305

0306

0307

0308

0309

but showing

0300

301

302

303

304

305

306

307

308

309

is there problem loop ?

function did_ehmad_sec_submit($editform) { $count=0; $start=$editform['from_to']; $end=$editform['to_range']; $desc=$editform['description'];  ($i=$start;$i<=$end;$i++) { $result = mysql_query("insert did_number(did_number, description) values ('$i','$desc')"); }  return $result;  } 

courtesy : in php, how add zero-padded numeric string , preserve 0 padding?

try using this..

sprintf('%04d', $num); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -