Start New Discussion within our Web Development Community

helloo....guys need a favour from you....okay this is the scenario
i have a attribute called document_no,
now i would like to append running numbers behind it to fill in a new attribute

document_no = 123222
serial_no = 12322201

now the number starts from 01 and go on up to 64(according to the pallet no.)

any idea how to do this...because not that i append...the '0' goes missing and its 1232221

thank you...

echo "wrong way<br/>";
for($i=0; $i<20; $i++)
  $a = "23".$i; 
  echo $a."<br/>";

echo "an easy solution<br/>";
for($i=0; $i<20; $i++)
  $a = (int)"23".($i<10 ? "0".$i : $i); 
  echo $a."<br/>";

heyy...thank you for your help...i solve the problem d...

for($i=1; $i<=$palletno; $i++)
    $serial_no = $document_no.($i<10 ? "0".$i : $i);

$sql1="INSERT INTO $tbl_name1(invoice_no,container_no,document_no,part_no,spart_no,serial_no,scan_status)VALUES('".$invoice_no1."','".$container_no."','".$document_no."','".$part_no."','".$spart_no."','".$serial_no."','unscanned')" or die(mysql_error());		
		$result=mysql_query($sql1)or die(mysql_error());
This question has already been answered. Start a new discussion instead.