update or add to MYSQL not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: update or add to MYSQL not working

Post by onion2k »

pagegen wrote:

Code: Select all

               $yesterday = date('Y-m-d H:i:s', mktime(0,0,0, date('m'), date('d') - 1, date('Y')));
                $sql = "DELETE FROM TblBasket WHERE CartDate < '$yesterday'";
                mysql_query($sql) or die(mysql_error());
am using that to clear the cart every night so it wont be a problem..
So if I come to your site at 11:55pm and try to buy some stuff, and it takes me 10 minutes, won't my cart be deleted half way through purchasing?
pagegen
Forum Commoner
Posts: 32
Joined: Sat May 31, 2008 6:38 am

Re: update or add to MYSQL not working

Post by pagegen »

onion2k wrote:
pagegen wrote:

Code: Select all

               $yesterday = date('Y-m-d H:i:s', mktime(0,0,0, date('m'), date('d') - 1, date('Y')));
                $sql = "DELETE FROM TblBasket WHERE CartDate < '$yesterday'";
                mysql_query($sql) or die(mysql_error());
am using that to clear the cart every night so it wont be a problem..
So if I come to your site at 11:55pm and try to buy some stuff, and it takes me 10 minutes, won't my cart be deleted half way through purchasing?
oh no, should take a day.. ill test again :)

EDIT; nope, i gave a 3hour gap n it still stayed there.. after 1day gap delets
Post Reply