I have problem, I want to input data Invoice Number, when I try in phpmyadmin version 5.6.16 in my computer its working, but im upload to cpanel phpmyadmin v 5.5 its not working.
Result in V 5.6.16 :
- INV0001
- INV0002
- INV0003
Result in Cpanel/Hosting. V 5.5 :
- INV0001
- INV0001
- INV0001
it's duplicate, how to fix it? Thanks before.
<?php
$query = "SELECT max(invoice) AS invoice FROM orders";
$hasil = mysql_query($query);
$data = @mysql_fetch_array($hasil);
$lastinv = $data['invoice'];
$nextInv= (int) substr($lastinv, 3, 4);
$nextInv++;
$char = "INV";
$newInvoice = $char . sprintf("%04s", $nextInv);
?>