here a possible solution (untested)
<?php
$file = fopen("number.txt","rw");
$number = fread($file);
$number += 1; //the new number to proceed
fwrite($file,$number);
fclose($file);
?>
Вопрос
i have a website for E-invoice. I'm trying to find the best way where i can retrieve a number "in my case the invoice number" and when creating a new invoice the old number will be saved somewhere and retrieved to be +1.
for now i know that i can't use cookies or session of course and i can't use HTML5 local storage to save the last invoice number and i know that it have to be something on the server side.
can i use xml or save the value in a text file then retrieve it? can anyone please inform me of the best approach to do this.
Решение
here a possible solution (untested)
<?php
$file = fopen("number.txt","rw");
$number = fread($file);
$number += 1; //the new number to proceed
fwrite($file,$number);
fclose($file);
?>