PHP/MYSQL 每日交易应以三个零开头
In PHP/MYSQL daily transactions should start with three zeros
我需要你的帮助来维护每天以三个零开头后跟一些数字的交易(示例:2015***000)并且必须为下一次交易递增(示例:2015***001、2015* **002) 等等。
请帮助我如何处理当天第一笔交易应以三个零开头并进一步增加的交易,如第一个示例所示...
谢谢
苏里亚普拉卡什
可能对你有帮助
$transactionid = date('Y').date('d').'000';
$gettransid = mysql_query("select * from daily_transaction_tbl order by transaction_id desc");
$fetchtrans = mysql_fetch_array($gettransid);
$transfetchdid = $fetchtrans['transaction_id']+1;
// second time if u insert the query you need to use this
if($transfetchdid == ""){
$inserttrans = mysql_query("insert into daily_transaction_tbl transaction_id values ($transactionid)");
}else{
$inserttrans = mysql_query("insert into daily_transaction_tbl transaction_id values ($transfetchdid)");
}
我需要你的帮助来维护每天以三个零开头后跟一些数字的交易(示例:2015***000)并且必须为下一次交易递增(示例:2015***001、2015* **002) 等等。 请帮助我如何处理当天第一笔交易应以三个零开头并进一步增加的交易,如第一个示例所示...
谢谢 苏里亚普拉卡什
可能对你有帮助
$transactionid = date('Y').date('d').'000';
$gettransid = mysql_query("select * from daily_transaction_tbl order by transaction_id desc");
$fetchtrans = mysql_fetch_array($gettransid);
$transfetchdid = $fetchtrans['transaction_id']+1;
// second time if u insert the query you need to use this
if($transfetchdid == ""){
$inserttrans = mysql_query("insert into daily_transaction_tbl transaction_id values ($transactionid)");
}else{
$inserttrans = mysql_query("insert into daily_transaction_tbl transaction_id values ($transfetchdid)");
}