<?
include("../opendb.php");
$re=mysqli_query($db,"select * from vehopstock");
$i=1;
while($row=mysqli_fetch_array($re))
{
 $code=substr($row[dano],0,5).$i++.substr(time(),7,3);  
 $code=str_replace(' ','-',$code);
 $sql="update vehopstock set code='$code' where dano='$row[dano]'";
 mysqli_query($db,$sql) or die(mysqli_error());
 print $sql.'<br>';

}
?>
