Miko 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? Link to comment https://forums.phpfreaks.com/topic/170309-deleted-some-specifique-in-mysql-using-php/ Share on other sites More sharing options...
perrij3 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. 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...
taquitosensei 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) 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...
redarrow 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 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
Archived
This topic is now archived and is closed to further replies.