Jump to content

Database entry help!


pacitto513

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/294943-database-entry-help/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/294943-database-entry-help/#findComment-1506981
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/294943-database-entry-help/#findComment-1507000
Share on other sites

Archived

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

×
×
  • Create New...

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.