简体   繁体   English

如何在php中回显和自动增加收据号码?

[英]How to echo and auto increment receipt number in php?

I have a database, and table fees.我有一个数据库和表费。 In which I have to generate a receipt of each payment.其中我必须生成每笔付款的收据。 But I want that receipt number field must first echo receipt number which is one increment (+1) of last receipt number.但我希望收据编号字段必须首先回显收据编号,这是最后一个收据编号的一个增量 (+1)。 For example, last receipt is 1 than new receipt should be 2 and non editable.例如,上次收据为 1,而新收据应为 2 且不可编辑。

I am bit confused in that.我对此有些困惑。

My field code is:我的域代码是:

<label class="field-title">Reciept Number <span class="form-req">*</span></label>
<input type="text" name="reciept_number" class="span4" value="<?php 

$data =  max(mysqli_fetch_array(mysqli_query($conn,"SELECT reciept_number FROM fees"))); echo $data; ?>" readonly>

Dont understand your question exactly but maybe you want something like this:不完全理解你的问题,但也许你想要这样的东西:

<label class="field-title">Reciept Number <span class="form-req">*</span></label>
                                <input type="text" name="reciept_number" class="span4" value="
<?php 
$data = mysqli_fetch_row(mysqli_query($conn,"SELECT max(reciept_number)+1 FROM fees")); 
echo $data[0]; 
?>" readonly>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM