GFXUniverse Posted February 8, 2010 Share Posted February 8, 2010 hi guyz m creating a website, about 3D products for example i have 3D models in my website table for MYSQL is 3d_models Feilds: id name description thumbnail_image preview_images???(we can only add single image URL) but i wanna add multiple images for a product. do i need to have another table called preview_images? that will be related to 3d_models table? or can it be done in a single 3d_models table? i just need a blue print concept, Please help!!!! Quote Link to comment https://forums.phpfreaks.com/topic/191306-need-help-about-storing-data-into-database-phpmysql/ Share on other sites More sharing options...
premiso Posted February 8, 2010 Share Posted February 8, 2010 Another table for preview_images which has a 3d_models id as a foreign key would be the best way to do it. Quote Link to comment https://forums.phpfreaks.com/topic/191306-need-help-about-storing-data-into-database-phpmysql/#findComment-1008647 Share on other sites More sharing options...
GFXUniverse Posted February 8, 2010 Author Share Posted February 8, 2010 hmmm i see it seems best way,,, but how can i give 3d_model_id to preview_images table? Actually all the data would be inserted at the same time,, for example Table: 3d_models id (Auto increment) name (POST) description (POST) thumbnail_image (POST) Table: preview_images image (POST) thumb (POST) 3d_model_id ??? how would i insert 3d_models' id here??? which is not auto increment?? and i don't know in advance that what id would be inserted for 3d_model's table id?? Quote Link to comment https://forums.phpfreaks.com/topic/191306-need-help-about-storing-data-into-database-phpmysql/#findComment-1008653 Share on other sites More sharing options...
Arnerd Posted February 8, 2010 Share Posted February 8, 2010 u got to have a relation between the two tables for instance, in ur models table u need a field modelID inthere comes the number corresponding to the actual modelID in the other table like 1. option1 2. option 2 3. option 3 Quote Link to comment https://forums.phpfreaks.com/topic/191306-need-help-about-storing-data-into-database-phpmysql/#findComment-1008713 Share on other sites More sharing options...
GFXUniverse Posted February 8, 2010 Author Share Posted February 8, 2010 sorry i didn't get u Quote Link to comment https://forums.phpfreaks.com/topic/191306-need-help-about-storing-data-into-database-phpmysql/#findComment-1009050 Share on other sites More sharing options...
GFXUniverse Posted February 9, 2010 Author Share Posted February 9, 2010 mmmmm finally i got it how can i do this and would like to share with u guyz as well please correct me if there is another way to do it,, SOLUTION: Table 3d_models: id name description thumbnail special_id Table preview_images: id thumbnail image special_id now there is a relation between 3d_models and preview_images tables i can insert special id like this $special_id = md5($fileName . date("d-m-y") . time()); Quote Link to comment https://forums.phpfreaks.com/topic/191306-need-help-about-storing-data-into-database-phpmysql/#findComment-1009249 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.