I'm keeping track of inventory using a txt file. For example my inventory.txt file currently has:
Item1,50
I'm trying to write a PHP line that will remove the quantity ordered from the inventory.txt file. So if I ordered 4 Item1s, I'd like the script to subtract 4 from 50.
if ($Item1qty > 0) {
// Handle external txt file
$handle= fopen("inventory.txt");
$orders = count($handle);
if ($orders == 0) {
echo "<p><strong>No orders pending.
Please try again later.</strong></p>";
else ($Item1qty - $Item1)
}
//Output for Order Results
echo $Item1qty." Item1<br />";
}
Any help would be appreciated, this is what I did, but it doesn't work. I'm not really sure how to handle an external file.😕