runnin number in php


#1

[php]

<? include "db1.php"; $sql="select * from voucher"; $result=mysql_query($sql)or die(mysql_error()); $id_index=date('dmy'); $r=mysql_num_rows($result); $c=$r+1; $t_id="EP".$id_index."-".$r; echo $t_id; ?>

[/php]
i use this code to generate ID…out i get is EP100407-1…how to change the output to this EP100407-0001…already try in google but cannot get the answer…thanks in advanced


#2

here the solution

[php]
$t_id=“EP”.$id_index."-".sprintf("%04d", $r);
[/php]