This topic is locked

Implement Multiple Selection Dropbox as record

4/16/2024 7:39:01 PM
PHPRunner General questions
A
asawyer13 authorDevClub member

I am currently using a multiple selection dropbox for some tags or keywords. Works well, and stores everything in one field, but it makes it more difficult if someone changes the keywords table that is used in the miltiple selection dropbox. Plus it's more complicated to search.

Is it possible to implement a way where when the record that has the mutliple selection dropbox, to actually store the id's of the tags/keywords in a separate table? I don't care if the original field still has the text for the tags/keywords, however it would be best if I could load the dropbox tags from the detail records, and save them to the detail records table, I'm assuming in a before record added and the before edit saved.

It would make searching much easier, and faster.

Thanks
Alan

fhumanes 4/17/2024

Hello Alan,

As I explain in my tutorial, the case you propose is possible to get Mantaner and nevertheless, dispose of the standardized data model so that it is easy for you to obtain statistics or reports.

The tutorial is in this URL: https://fhumanes.com/blog/otros-ejemplos/tutorial-curso-basico-de-phprunner/

img alt

In the data model, the "vide_pelicula" entity that has the "vide_cata_interprete...." field where the multiple keys separated by commas admits.

In the "v_vide_peli_interprete" view of the same standardized information, to produce the reports or accesses you need.

CREATE VIEW `v_vide_peli_interprete` AS select `p`.`idvide_pelicula` AS `idvide_pelicula`,`i`.`NombreyApellidos` AS `NombreyApellidos_Interprete` from (`vide_pelicula` `p` join `vide_cata_interprete` `i`) where (find_in_set(`i`.`idvide_cata_interprete`,`p`.`vide_cata_interprete_idvide_cata_interprete`) > 0)

In addition, you have an example like your planting "Interpreters" and the standardized model with "themes", so you can see that everything has its advantages and inconveniences.

Greetings,
fernando