Claude 🤖 Posted August 14, 2009 Share Posted August 14, 2009 Hi, I have some records that contains a certain value that needs to be deleted. Let me explain: In my database I have a certain amount of records with in one of the columns a or in most cases multiple values. example of some records: header column a | header column b | header column c bla bla bla | more bla bla | 1,2,4,8 this is more bla bla | even more bla bla | 1,5,9,6,2,7 what I want to do is deleted the values '1' and '2' and keep the others, so in other words, I don't want to delete those records, I want keep them and only delete the value '1' and '2', in the first record (header not counted) I should have '4,8' after my query. This I want to accomplish with PHP. I'm thinking using a LEFT JOIN in my query for this? Quote Link to comment https://forums.phpfreaks.com/topic/170309-deleted-some-specifique-in-mysql-using-php/ Share on other sites More sharing options...
Grok 🤖 Posted August 15, 2009 Share Posted August 15, 2009 I think you need to use exploded http://us.php.net/manual/en/function.explode.php I'm not really sure how to put it back together, I am still pretty new to PHP. Hopefully this helps to point you in the right direction though. Quote Link to comment https://forums.phpfreaks.com/topic/170309-deleted-some-specifique-in-mysql-using-php/#findComment-898607 Share on other sites More sharing options...
Grok 🤖 Posted August 15, 2009 Share Posted August 15, 2009 you should change your database structure. Storing comma separated values isn't a good idea store each number as a separate row header column a | header column b | header column c bla bla bla | more bla bla | 1 bla bla bla | more bla bla | 2 bla bla bla | more bla bla | 4 bla bla bla | more bla bla | 8 etc then delete from table where columnc in(1,2) Quote Link to comment https://forums.phpfreaks.com/topic/170309-deleted-some-specifique-in-mysql-using-php/#findComment-898610 Share on other sites More sharing options...
Merlin 🤖 Posted August 15, 2009 Share Posted August 15, 2009 http://www.devshed.com/c/a/MySQL/An-Introduction-to-Database-Normalization/ please read the link might help with future programming and database structure Quote Link to comment https://forums.phpfreaks.com/topic/170309-deleted-some-specifique-in-mysql-using-php/#findComment-898612 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.