php - Invoice number having one added to it up to 10, then stopping -


im having strange problem, using following script pull last invoice number database , add 1 it, works fine......until 10 invoices, odd reason keep getting 10 invoice number on , on again.

      <?php      $sqlinv = <<<sql        select max(invoiceid) maxid `sales`     sql;     if(!$resultinv = $db->query($sqlinv)){ die('there error running query [' . $db->error . ']');}      while($rowinv = $resultinv->fetch_assoc()){      $previousinvoiceid = $rowinv['maxid'];     }     $invoiceid = $previousinvoiceid +1;      echo $previousinvoiceid;     echo $invoiceid;     ?> 

$previousinvoiceid echos out 9 $invoiceid echos out 10 if delete few records works again fine, gets 10 starts repeating 10 again, though treats 9 highest number time.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -