时间:2021-07-01 10:21:17 帮助过:3人阅读
$rand_invoice_id=rand(0000,9999); $current_time=date("Y-m-d H:i:s"); $current_time_start=date("Y-m-d")." "."07:00:00"; $tomorrow_time_start=date("Y-m-d", strtotime('+1 day'))." "."07:00:00"; $yesterday_time_start=date("Y-m-d", strtotime('-1 day'))." "."07:00:00"; $row=1; do { $query="SELECT * FROM CART WHERE (invoice_id='$rand_invoice_id') AND (order_time BETWEEN '$current_time_start' AND '$tomorrow_time_start')"; $result=queryMysql($query); $rows=mysql_num_rows($result); if($rows != 0) { $rand_invoice_id=rand(0000,9999); } } while($row!=0);