WebmasterSite.net: PHP scripts to enable your creativity
WSN Links PHP Directory Software
PHP Scripts Webmaster Links Support Forums

Register | Forgot Password

I want to get rid of most of my links
What is the easiest and quickest way of doing this

Version: 4
printPrint


I want to get rid of most of my links
capitaine
Forum Regular
Avatar

Usergroup: Customer
Joined: Aug 05, 2005
Total Topics: 94
Total Posts: 273
Posted 02/14/07 - 07:02 AM:
quote post
#1
I have about 16,000 links in my directory. I want to get rid of most of them except for 1 category and her subcats. What is the easiest and quickest way of doing this?

Many thanks

Truth don die
Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 57
Total Posts: 6316
Posted 02/15/07 - 01:08 AM:
quote post
#2
I think this query will work, but it's your risk:
DELETE FROM wsnlinks_links WHERE catid != x AND parentids NOT LIKE '%|x|%';
where x is the category id.

"Do things you love doing, because then it ain't work. Don't do something you don't really enjoy, because you're never going to work hard enough at it." - Bob Young, founder of Red Hat
capitaine
Forum Regular
Avatar

Usergroup: Customer
Joined: Aug 05, 2005
Total Topics: 94
Total Posts: 273
Posted 02/21/07 - 02:45 AM:
quote post
#3
nah didn't work... this is what I got from PhPMyAdmin:

[b]Deleted rows: 0 (Query took 0.0118 sec)[/b]
SQL-query :
DELETE FROM wsnlinks_links WHERE catid != 1 AND parentids NOT LIKE '%|1|%'


nothing was actually deleted - is there another way? Maybe manually dropping top-level tables through PhPMyAdmin....I have no idea whether possible or not though - would prefer to run a query.

Truth don die
Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 57
Total Posts: 6316
Posted 02/21/07 - 06:13 AM:
quote post
#4
Maybe you use a different tables prefix.

"Do things you love doing, because then it ain't work. Don't do something you don't really enjoy, because you're never going to work hard enough at it." - Bob Young, founder of Red Hat
capitaine
Forum Regular
Avatar

Usergroup: Customer
Joined: Aug 05, 2005
Total Topics: 94
Total Posts: 273
Posted 02/21/07 - 06:52 AM:
quote post
#5
nope - its in its own database, I have no need to use anything but the defaults...

Truth don die
Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 57
Total Posts: 6316
Posted 02/23/07 - 08:57 AM:
quote post
#6
Well can you use the search page in phpmyadmin to do a search for those links? That should involve using the LIKE %...% condition with |1| for the parentids field and 1 for the catid field. Once you can search them, can you then change it to 'not' to find what isn't them?

"Do things you love doing, because then it ain't work. Don't do something you don't really enjoy, because you're never going to work hard enough at it." - Bob Young, founder of Red Hat
capitaine
Forum Regular
Avatar

Usergroup: Customer
Joined: Aug 05, 2005
Total Topics: 94
Total Posts: 273
Posted 02/23/07 - 03:45 PM:
quote post
#7
well guess what, the original query you gave me works after all... what I discovered, in a rounabout way, was that I decided to upgrade to the latest PhpMyAdmin (I was on a very old version) - and I ran the query after upgrading and it works very smoothly smiling face

Thanks!

Truth don die
Search thread for
Download thread as


You don't have permission to post.

Please login or register.

   
 
© 2008 Paul Knierim. All rights reserved.