toad78 Posted October 11, 2007 Share Posted October 11, 2007 I'm a newbie here and hope I'm not posting in the wrong forum! I'm using Dreamweaver 8 and am trying to develop an insert record form to do the following: #1: allow the user to upload a file to the server's folder (this is just for registered users) and have this filename recorded in a database table called 'images'. #2: before the user uploads the file, they need to choose from a list box which category the file is to be associated with. The categories are titles of other web pages that have their own database tables. I do have a 'categories' database table that has a list of categories developed within it. Each web page needs to be able to display 2 or more images at a time (I guess that's problem #3). I have already developed separate tables for my web page(s). I've developed the 'images' table with the following criteria: Table: images image_id INT UNS AUTO PRI KEY filename VARCHAR caption VARCHAR The 'categories' table: Table: categories cat_id INT UNS AUTO PRI KEY category VARCHAR Then there's my web page(s) table: As an example: Table 'sandf' sandf_id INT UNS NOT NULL AUTO PRI KEY content TEXT I would like to know how to develop the upload to where it will record the filename, associate the web page(s) table with the filename so I can display the images from the server folder to my web page. Am I not doing something correctly? I'm quite ignorant about developing PHP/MySQL but am enjoying learning how to develop a CMS. Heather Quote Link to comment https://forums.phpfreaks.com/topic/72733-upload-filename-to-database-many-to-many-relationship/ Share on other sites More sharing options...
MrTK Posted October 21, 2007 Share Posted October 21, 2007 I think you splitting your database in such an extensive manner. I think you could get rid of the pictures table, thats one. Second, include the picture names with either your webpages table (for each record, i'm geussing it is a webpage, so have a column for pictures, and if you have multiple pictures, upon uploading create a string of filenames delimited with a character, say | ) or have them stored in the same way in the categories table. Now I'm not sure how many pictures you expect to have for each page, if your possibilities are open then the above concept might work better for you, otherwise, if you could restrict the number of pictures per page, say 4 pictures or less, you could probably get away with creating a column for each picture in where ever you want to store the pictures names. Of course, in your webpages table you should have a column to associate it with a category. Say, cat_id name cat_name. Just so you would know how to relate things together. Quote Link to comment https://forums.phpfreaks.com/topic/72733-upload-filename-to-database-many-to-many-relationship/#findComment-374900 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.