littlkj5 Posted June 28, 2006 Share Posted June 28, 2006 How do i delete something from the DB through PHP? Quote Link to comment https://forums.phpfreaks.com/topic/13153-deleting-something-out-of-mysql/ Share on other sites More sharing options...
sammermpc Posted June 28, 2006 Share Posted June 28, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/13153-deleting-something-out-of-mysql/#findComment-50600 Share on other sites More sharing options...
SharkBait Posted June 29, 2006 Share Posted June 29, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/13153-deleting-something-out-of-mysql/#findComment-50821 Share on other sites More sharing options...
xyn Posted June 29, 2006 Share Posted June 29, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/13153-deleting-something-out-of-mysql/#findComment-50851 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.