-2
I want to add a "license" for a purchase in my database, plus this license that my "customer" will buy will have an expiration date, let’s say he bought a license...
INSERT INTO compras (userid, pluginid) VALUES ('$userid', '$pluginid');
Now, I want to make this INSERT that I did go out in a month, for example, how do I do this??
More at INSERT time, which I fill in the field DATA_DE_VALIDADE?
– DaviDEV
Something like ADDDATE(CURDATE(), INTERVAL 31 DAY), ie the date when "expires" the purchase. In the case 31 days of the current date.
– Motta
Type: INSERT INTO purchases (userid, pluginid,expiration) VALUES ('$userid', '$pluginid',ADDDATE(CURDATE(), INTERVAL 31 DAY)); ??????
– DaviDEV
Yes, but the column needs to exist in the table, for this see ADD COLUMN emhttp://dev.mysql.com/doc/refman/5.7/en/alter-table.html
– Motta
I think Motta’s suggestion is better, never discard a customer’s purchase history. even because, if your system happens to provide the same license number of a customer who has already purchased it, you may get complicated
– Leandro RR
No, I’m just using it to absorb knowledge, I don’t have a web shop or anything like that.
– DaviDEV
then just think of it as good practice!
– Leandro RR