PDA

View Full Version : Need More Help Un-Doing Query


dieselpowered
08-03-2005, 06:29 AM
Hey everyone, alright, I need to remove this query from my database...what would be the correct command to run??

INSERT INTO phrase (languageid,varname,text,phrasetypeid) VALUES ('-1', 'saved_affiliate_x_successfully', '<i>{1}\'s</i> has been updates!', '9000');
INSERT INTO phrase (languageid,varname,text,phrasetypeid) VALUES ('-1', 'deleted_affiliate_x_successfully', '<i>{1}</i> has been deleted!', '9000');
INSERT INTO phrase (languageid,varname,text,phrasetypeid) VALUES ('-1', 'deleted_affiliate_x_unsuccessfully', '<i>{1}</i> was not deleted due to your choice selection.', '9000');
INSERT INTO phrase (languageid,varname,text,phrasetypeid) VALUES ('-1', 'inserted_affiliate_x_successfully', '<i>{1}</i> has been successfully added to the data base.', '9000');
INSERT INTO phrase (languageid,varname,text,phrasetypeid) VALUES ('-1', 'inserted_affiliate_x_unsuccessfully', 'This affiliates could not be added to the database because you either did not enter an affiliate name or an affiliate url or an affiliate email.', '9000');
INSERT INTO phrase (languageid,varname,text,phrasetypeid) VALUES ('-1', 'saved_affiliate_settings_successfully', 'Settings for Affiliates Addon Updated.', '9000');
INSERT INTO phrase (languageid,varname,text,phrasetypeid) VALUES ('-1', 'updated_affiliate_type_successfully', '<i>{1}</i> was updated successfully.', '9000');
INSERT INTO phrase (languageid,varname,text,phrasetypeid) VALUES ('-1', 'updated_affiliate_type_unsuccessfully', 'The type was <u>not</u> updated because the types name was left blank.', '9000');
INSERT INTO phrase (languageid,varname,text,phrasetypeid) VALUES ('-1', 'saved_affiliate_type_unsuccessfully', 'This type/category was not added to the database due to the name of this type/category not being filled in.', '9000');
INSERT INTO phrase (languageid,varname,text,phrasetypeid) VALUES ('-1', 'saved_affiliate_type_successfully', '<i>{1}</i> was added to the database successfully.', '9000');
INSERT INTO phrase (languageid,varname,text,phrasetypeid) VALUES ('0', 'approved_affiliate_x_successfully', '<i>{1}</i> has been approved successfully and an email has been dispatched to its admin\'s email.', '9000');

Thank you!!

Marco van Herwaarden
08-03-2005, 06:31 AM
DELETE FROM phrase WHERE varname = 'saved_affiliate_x_successfully';

Repeat that for each phrase. (changing the name ofcourse).

Colin F
08-03-2005, 06:32 AM
Hey everyone, alright, I need to remove this query from my database...what would be the correct command to run??



Thank you!!

That would be more than one query :)

Run a query accordingly for each of the above.
DELETE FROM phrase WHERE varname = 'saved_affiliate_x_successfully' LIMIT 1;

Exchange the varname each time

Marco van Herwaarden
08-03-2005, 06:39 AM
Slooooooow Colin :) :D

PS That limit is not needed, and could even have undesired side effects.

dieselpowered
08-03-2005, 06:42 AM
excellent...thank you guys!!! as always, appreciate the help :) I am sure I will have more questions, you must forgive my ignorance :)

Colin F
08-03-2005, 06:47 AM
Slooooooow Colin :) :D

PS That limit is not needed, and could even have undesired side effects.

Oh bugger off :p

Why could it have undesired side effects?

Marco van Herwaarden
08-03-2005, 06:52 AM
If you have translations into other languages for that phrase, those would not be deleted. Only 1 (and since no ORDER BY is given, this is arbitrary) phrase will get removed.

dieselpowered
08-03-2005, 07:18 AM
Hi there...sorry me again...alright I need to undo a bunch of these:

$DB_site->query("INSERT INTO ".TABLE_PREFIX."phrase (languageid, varname, text, phrasetypeid) VALUES (0, 'tratings', 'Trader Ratings', 1)");

So how would that look?? Like this:

DELETE FROM phrase WHERE varname = 'tratings', ;Trader Ratings';

Thanks for the help!!

Marco van Herwaarden
08-03-2005, 07:22 AM
Just:
DELETE FROM phrase WHERE varname = 'tratings'

dieselpowered
08-03-2005, 07:47 AM
LOL I am sorry, what would these be?

$DB_site->query("ALTER TABLE ".TABLE_PREFIX."user ADD ratetradetotal SMALLINT(5) DEFAULT '0' NOT NULL");

$DB_site->query("ALTER TABLE ".TABLE_PREFIX."user ADD INDEX ratetradetotal (ratetradetotal)");

I very much appreciate your help!

I was thinking it would be:

ALTER TABLE user DROP ratetradetotal;

ALTER TABLE user DROP INDEX ratetradetotal ;

Marco van Herwaarden
08-03-2005, 08:06 AM
Correct

dieselpowered
08-03-2005, 08:08 AM
Hmmm says it cannot drop:

ALTER TABLE user DROP INDEX ratetradetotal;

Nevermind, looks like when I dropped the first one, it dropped the second?? Would it have done that?

Colin F
08-03-2005, 08:41 AM
Hmmm says it cannot drop:

ALTER TABLE user DROP INDEX ratetradetotal;

Nevermind, looks like when I dropped the first one, it dropped the second?? Would it have done that?

I don't know MySQL that well, but I'd say that's possible, as it's an index on the table and doesn't make sense to keep that if the table itself isn't around anymore.

Marco van Herwaarden
08-03-2005, 09:06 AM
Yes, the index is based on that column, so if you drop the column the index also get dropped.

dieselpowered
08-03-2005, 04:23 PM
WOOHOO I am an SQL genious!!! :)

Thanks guys for taking the time to help...have a great one!