I have a site with products I sell and each product has its own product code. The problem is that recently we changed all product codes to all products.
Because all sales inserted in MySQL before today used the old product code, when I try to get a report to see how many of one product has been sold system find 0 because it looks for the new product code while older sales was inserted with the old one.
Solution:
Even if it is a pain there is no other way than updating all products sold and inserted in MySQL updating the old product code with the new one this way it will work fine.
I need to update like this:
$update = mysqli_query($database, "
update `sales` SET code = 0001 WHERE `code` = '4574645448458'
");
The only problem is that it updates only the first product with this product code but I have houndreds of products sold with the same product code...
How to solve this in some bulk way?
examples of what I will change:
code 4574645448458 for 0001 code 4574645448459 for 0002
and so on