Sorry,
the updated code
but it did not delete the dataCode:$sql = mysql_query("DELETE FROM $store_item1 WHERE TO_DAYS(item_exp) - TO_DAYS(NOW()) < 0");
| SitePoint Sponsor |
Sorry,
the updated code
but it did not delete the dataCode:$sql = mysql_query("DELETE FROM $store_item1 WHERE TO_DAYS(item_exp) - TO_DAYS(NOW()) < 0");


Either "$store_item1" did not have the right value, or there's nothing in the database with an expiration date in the past.
To see if the query's running or not:
PHP Code:$sql = "DELETE FROM $store_item1 WHERE TO_DAYS(item_exp) - TO_DAYS(NOW()) < 0";
$result = mysql_query($sql) or die(mysql_error());
17-29% of paid ad clicks are fraudulent. Get protected with Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more.
Dan,
What I did to make sure the store_item gives resultd
so the date is thereCode://show categories first $get_cats = "SELECT item_id, item_title, item_desc, item_subdesc, time_stamp, store_image, item_image, item_code, item_exp, sort_id, dept_id, TO_DAYS(item_exp) - TO_DAYS(CURDATE()) AS item_days_to_expiration, TO_DAYS(item_exp) - TO_DAYS(NOW()) As t FROM store_item1 WHERE item_exp LIKE '200%%%%%' ORDER BY `item_exp`ASC limit $dept_id,$limit"; $get_cats_res = mysql_query($get_cats) or die(mysql_error()); $item_id = $cats[item_id]; $sort_id = $cats[sort_id]; $item_title = stripslashes($cats[item_title]); $item_desc = stripslashes($cats[item_desc]); $item_code = stripslashes($cats[item_code]); $item_exp = stripslashes($cats[item_exp]); $item_image = stripslashes($cats[item_image]); $store_image = stripslashes($cats[store_image]); $item_subdesc = stripslashes($cats[item_subdesc]); $item_days_to_expiration = $cats['item_days_to_expiration']; $t = $cats['t']; $t shows as -4, -3 , -2 and all


This query does not use any date from your other query. It doesn't need any external data. The problem is you used a variable for the table name when I don't think you meant to.
PHP Code:$sql = "DELETE FROM store_item1 WHERE TO_DAYS(item_exp) - TO_DAYS(NOW()) < 0";
$result = mysql_query($sql) or die(mysql_error());
17-29% of paid ad clicks are fraudulent. Get protected with Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more.
I get this message
Code:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE TO_DAYS(item_exp) - TO_DAYS(NOW()) < 0' at line 1
Dan,
Any more suggestions.
The message I get is
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE TO_DAYS(item_exp) - TO_DAYS(NOW()) < 0' at line 1


It's because of what I said in my last post.
You really should post a listing in the Looking to Hire forum or your favorite job postings site to find a programmer.
17-29% of paid ad clicks are fraudulent. Get protected with Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more.





^^^ Probably the best bit of advice in this thread.![]()
Hi Dan & SiteGuru,
First of all I would like to thanks you both for helping me with your suggestions and comments.
I just wanted to understand that what level of knowledge/expertise you should have before you can request for help in the forums?
Lot of people like me are starters who may or may not have software knowledge background but may be trying to learn and understand how the scripts work.
More important is that there should be a zeal, commitment and dedication to learn.
Nothing is impossible.
I know lot of people like you have quite a knowledge that the qeries put forward by me must have irritated you..... but try to go back to the first year after you learnt programming.... how did you feel.
Hope you would understand and not try to make a person feel that he is use for nothing.
regards





I think what Dan was suggesting (and which I agree with) is that it looks like you are trying to run before you can walk - you've bitten off more than you can chew. If what you are working on is for a commercial venture then you'd be much better getting a professional to do this for you than trying to muddle your way through.
The complexity of what you're trying to do looks very like what would be needed for a commercial venture. If it's simply a learning exercise then it's way too advanced for the apparent level you are at right now.
The comment wasn't intended as an insult on your capabilities, just some friendly advice on how to achieve quickest resolution to your immediate requirements.
![]()
Siteguru,
Thanks for your reply.
Its all the learning for personal use. I have PM'ed you the examples of implementation... rather than posting here.
Take care.
regards
Bookmarks