sql - Adding unknown number of values to MySQL database -
my situation creating wordpress plugin, creates table in directory on activation.
this table holds information entered plugin, when information being entered user has option upload images. number choose upload not know.
the issue having figuring out how add these urls database, sure can put them in there again not know how many urls need added.
as cannot use normalization wordpress, how store urls in db. upload 5 images not have 5 separate columns (url 1, url 2...)
i should note these images fetched using loop, each image sent off regardless of number uploading.
any appreciated cheers.
also, can make additional table with:
id, information_id, filename, ordr
firstly, insert infromation_table, last inserted id
then, insert filenames_table filenames in order
finally, can select data:
select i.id, i.title, group_concat(a.filename order a.ordr asc separator ',') filenames information_table join filenames_table on (a.information_id = i.id)
Comments
Post a Comment