Jump to content

Dablue

New Members
  • Posts

    6
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Dablue's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Would it be a 2 step process... ? 1. Get the timestamp from the table. 2. Then add 10 days to the timestamp and compare it against today? Or Can it be done in one sql statement? Something like? DELETE FROM table WHERE CURDATE() > ADDDATE('date_logged', INTERVAL 10 DAY)
  2. Hi Folks, I've made a shopping cart and basically I want to delete data out of a few tables which isn't needed (and I want to know the sql on how to do it!) Basically they'll be loads of order rows (amongst other things) which will be stored and won't be needed (the customer hasn't completed the order etc). I'm thinking the best way to clear out the data which isn't needed is via cron. I'm going to log when each row is added to the table with a timestamp... I then want to be able to delete rows from several tables which are 10 days old... I've got a cookie logged on the customer's pc which expires after a week. This cookie is their unique id which logs loads of of different things in various tables (order rows, coupons, postage etc.) I want to put the sql into a cron job and run it everyday. Anyone any ideas... I've tried messing with ADDDATE but I'm still not sure what I'm doing. Thanks in advance,
  3. Many thanks Wildbug - your 2nd solution: <input type=text name="quantity[order_row_id]" value="1"> was what I was looking for...
  4. That should do the trick mate, looks good to me
  5. Hi Folks, I'm working on a shopping cart and right now I'm looking at an update feature where the good shoppers of the world can update their quantities of various rows... I can't just do a straight $_POST[qty] because there are X number of rows in the order_rows table. I had a few thoughts on how to record the product id's which are associated to the qty input... I think the easiest would be to post all the qtys for the order_rows in an array... Then explode the array and then update the qtys based on there position in the order_rows table... But can it be done? I've not seen a WHERE clause which is based on row position, but I've got a hunch it can be done... There's no easy way of recording and tying the product id's to the qtys. Hope that makes sense... so if $array[0] = 1 and $array[1] = 2, I want to update the 1st occurrence in the cart table (associated to the shoppers session id) to 1 and the 2nd occurrence to 2. The only way I can see it working would be to make sure the order_rows table are displayed (ORDER BY) by their product_id's and then when I'm updating, do the update based on that display... Any thoughts please? TIA
  6. DATE_FORMAT() is a darn site easier, but FYI using the CURDATE() function, you could use the following... $sql = "SELECT CURDATE()"; $query = mysql_query($sql, $conn); $row = mysql_fetch_array($query); $date = explode('-', $row[0]); $date_y = $date[0]; $date_m = $date[1]; $date_d = $date[2]; $array = array("$date_m", "$date_d", "$date_y"); $new_date = implode("-", $array); echo $new_date;
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.