gbaya Posted November 7, 2015 Share Posted November 7, 2015 I am trying to figure out what to do from here. I am using mysql for my database. In my form from mysql I wish to have the possibility for people to upload from 1 to many images that can be queried along with the data submitted in the form. I am not asking for someone to write me the code, but to point me in the right direction of what type of solution I can use or what I can read on to learn to get this done. User example here: 1. a registered user is filling out a form for example a car for sale ad. 2. user wishes to upload images relating to that car sale ad. 3.if the user fills out the car for sale form and clicks submit/next.How to display the form the user just clicked submit in the next page to appear,so the user can add images there/here? I hope someone can point me in the right direction or can give me their input on what else I can read on to do this. Thank you in advance Quote Link to comment https://forums.phpfreaks.com/topic/299355-php-mysql-one-to-many-relationship-or-something-else/ Share on other sites More sharing options...
ginerjm Posted November 7, 2015 Share Posted November 7, 2015 Once the user begins the process by submitting the form and you save that info with an "id", you simply put out a form for the user to then submit images to be uploaded. Store those images in a folder with a table that relates each image file name to the "id" in a separate table. User table with id links to image table with id and image file name Store all images in one folder and always look in that folder for the image file name. Probably want to include the user "id" as a prefix to the image file name to ensure uniqueness. When you do a query you simply join the two tables together. You don't want to store the images themselves in a table - wasteful. Simply define a folder and just save the filename. Quote Link to comment https://forums.phpfreaks.com/topic/299355-php-mysql-one-to-many-relationship-or-something-else/#findComment-1525952 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.