pacitto513 Posted February 27, 2015 Share Posted February 27, 2015 Hello , I have a database and in this database there is a table called 'circles'. This table consists of a field/column called 'subscribers' and in this column there are multple arrays (e.g., '5', '6', '7'....) that I can explod in php. Now, my question is there a way where I can use the mysql_query("UPDATE") code in order to add another array value onto the end of the existing array list inside the 'subscribers' column? If so, how do I do this? Please help all code and examples are welcome. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/294943-database-entry-help/ Share on other sites More sharing options...
Barand Posted February 27, 2015 Share Posted February 27, 2015 In a relational database you don't store multiple delimited values in a single column, you normalize your data and problems like this go away. http://forums.phpfreaks.com/topic/273634-best-way-to-set-up-tables-when-multiple-values/?do=findComment&comment=1408360 Quote Link to comment https://forums.phpfreaks.com/topic/294943-database-entry-help/#findComment-1506981 Share on other sites More sharing options...
pacitto513 Posted February 27, 2015 Author Share Posted February 27, 2015 So would you recommend just creating a seperate table called 'subscribers' and just go from there and use that instead? Would this be the most efficient normalized method? Quote Link to comment https://forums.phpfreaks.com/topic/294943-database-entry-help/#findComment-1506999 Share on other sites More sharing options...
Barand Posted February 27, 2015 Share Posted February 27, 2015 That's right. Each subscriber record would contain circle_id subscriber_id Make the primary key (circle_id, subscriber_id) then you can't add the same subscriber twice for a circle. To add a new subscriber for a circle you then just add a record to this table which is a lot easier than what you were trying to do originally. Quote Link to comment https://forums.phpfreaks.com/topic/294943-database-entry-help/#findComment-1507000 Share on other sites More sharing options...
pacitto513 Posted February 27, 2015 Author Share Posted February 27, 2015 Thanks for your help. In the past Ive used this method that you mentioned many times however I was never too sure what the most efficient way for both the server/mySQL database and website was. Quote Link to comment https://forums.phpfreaks.com/topic/294943-database-entry-help/#findComment-1507005 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.