NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page MySQL – Delete Command

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 08-22-2008, 03:07 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
freeflow's Avatar
Join Date: Dec 2006
Posts: 236
freeflow is on a distinguished road
 



MySQL – Delete Command


I am looking for the right command to delete all entries in my
guestbook that have a HTTP in them.

Can you correct this command?

mysql_query("DELETE FROM guestbook WHERE Text='%http%'");


Thanks.
freeflow is offline  
Old 08-22-2008, 03:22 PM   #2 (permalink)
RJ
NamePros Webmaster


 
RJ's Avatar
Join Date: Feb 2003
Posts: 12,930
RJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatnessRJ Has achieved greatness
 



Find Marrow Donors! Cystic Fibrosis Parkinson's Disease
mysql_query("DELETE FROM guestbook WHERE Text LIKE '%http%'");
__________________
@DomainBuyer facebook
RJ is offline  
Old 08-22-2008, 04:26 PM   #3 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
I'd recommend making a database backup first. You never know, you may end up deleting more than you want to
Eric is offline  
Old 08-22-2008, 04:50 PM   #4 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,552
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
At least perform a select before the delete...
__________________
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
sdsinc is offline  
Old 08-22-2008, 04:52 PM   #5 (permalink)
NamePros Member
Join Date: Sep 2006
Posts: 99
Bruce_KD will become famous soon enoughBruce_KD will become famous soon enough
 



You can also add limits to your deletion, such as
Code:
Delete From `table` where `row` LIKE '%Something%' limit 1
What happens if an error comes up and Something = Nothing?
Then it clears your database.
Using Limit # stops it from deleting too many. It also speeds up queries when dealing with large databases.


Bruce
Bruce_KD is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 03:46 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger