Dynadot — .com Registration $8.99

MySQL – Delete Command

Spaceship Spaceship
Watch

freeflow

Established Member
Impact
13
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.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
mysql_query("DELETE FROM guestbook WHERE Text LIKE '%http%'");
 
0
•••
I'd recommend making a database backup first. You never know, you may end up deleting more than you want to ;)
 
0
•••
At least perform a select before the delete... ;)
 
0
•••
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
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back