Jump to content

Archived

This topic is now archived and is closed to further replies.

littlkj5

Deleting Something Out Of Mysql

Recommended Posts

Delete DB entries the same way you add them, but with a correspondingly different entry.  Instead of querying the database with an INSERT command, query it with a DELETE.  Check out the manual on mysql queries, the documentation is very complete.

Also check out the php reference on the commands mysql_query, as well as the many other embedded mysql php functions.

Share this post


Link to post
Share on other sites
If your deleting just 1 item from a database, even though there may be only 1 instance of it in the database I would still suggest using LIMIT 1 a the end of the query.

[code]
DELETE FROM myTable WHERE id = '4' LIMIT 1;
[/code]

Share this post


Link to post
Share on other sites
The only way of deleting something is the way SharkBait says,

This code below is deleting 1 thing...
[code]DELETE FROM Table WHERE id='1'[/code]

This is to delete everything...
[code]TRUNCATE Table[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.