<?php
	session_start();	
		
	require_once("db/db.php");	
	require_once("common/common.php");
	
	$strnewcartid = '';
	//生成购物车流水号
	$sql = sprintf("SELECT right(replace(replace(replace(replace(CONVERT(varchar(100), GETDATE(), 121),'-',''),' ',''),':',''),'.',''),15)AS DayTemp,right('000' + rtrim(ltrim(str(cast(rand()*999 as int)))),3)AS RndTemp");
	$result = querySql($sql);
	
	if($row = fetch_array($result))
	{
		$daytemp = trim($row['DayTemp']);
		$rndtemp = trim($row['RndTemp']);
		
		
		$strnewcartid = $daytemp.$rndtemp;
	}
	
	$_SESSION["main_defcarttempid"] = $strnewcartid;
	echo $strnewcartid;
		
	freeResult($result);	//释放数据库
	closeDb();				//关闭数据库
?>



