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
eg:

document_no = 123222
serial_no = 12322201
12322202
12322203

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...

Recommended Answers

All 2 Replies

<?php
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());
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.