Can anyone help me with a small script? PHP or Perl is fine.
Database: allisons_osc1
Table: products_groups
field: customers_group_price
Need to delete all entries that = 0.0000 in field customers_group_price
THX
JHS
Can anyone help me with a small script? PHP or Perl is fine.
Database: allisons_osc1
Table: products_groups
field: customers_group_price
Need to delete all entries that = 0.0000 in field customers_group_price
THX
JHS
Hi... I'm assuming that you just want to run this like once right? If that's the case, why not just do it from MySQL itself? The command in MySQL for a delete is pretty simple.
In your case,
That will remove all entries in the specified table that the WHERE command satisfy.USE allisons_osc1;
DELETE FROM products_groups WHERE customers_group_price='0.0000';
If you still need the script then just post here... I think I might be able to help out. Cheers~
I have to run it everytime after I enter a set of new products.
A bug somewhere in osCommerce SPPC... so the script would be much appreciated!
P.S. to everyone else that tries the above or below, be sure and make a backup copy of your database. Screwy things can happen and you can save yourself a whole lot of headache by having a database backup.
I learned that about two years ago![]()
Last edited by jhsands; 11-20-2007 at 10:17 AM. Reason: backup
Ahh.. ok. In that case, here's the script then.
It's pretty straight-forward. Database connection details are on the top of the page so you gotta set the username/password yada yada...
The script is meant to be viewed using a browser as I made a confirmation screen before deleting so that you can see how many number of rows will be affected and the records that will be removed.
There's 2 statements "$selquerystr" and "$delquerystr" that will be executed; just modify them as you deemed fit.
I bet you already know this but this script can be run by anyone who can get accessed to it (since there's no authentication prior) so, keep it in a cool dry place safe from prying eyes
Cheers~
P/s:
You gotta rename the file to .php since the upload attachment cannot accept php extension.
IF you just wanna run it from the prompt and do not need the confirmation, just edit the file and delete the entire // main body portion and only keep the "// proceed with delete" portion and the "//display result(s)" just to show some output.
Last edited by PsyCHZZZ; 11-20-2007 at 10:19 PM. Reason: Added additional footnotes