lill77 Posted November 25, 2008 Share Posted November 25, 2008 Hello can somebody help me please. . . I have created 2 tables in my phpMYADMIN im in version MySQL client version: 4.1.22. I have attached the two tables, I want to know if I can select info from them two ways by cat which will be make eg Ford, and by product eg Window or horn . . . Thanks [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/134224-solved-mysql-newcomer-help/ Share on other sites More sharing options...
waynew Posted November 25, 2008 Share Posted November 25, 2008 SELECT * FROM category SELECT * FROM products Quote Link to comment https://forums.phpfreaks.com/topic/134224-solved-mysql-newcomer-help/#findComment-698683 Share on other sites More sharing options...
revraz Posted November 25, 2008 Share Posted November 25, 2008 What field in product? Would it be Description? You can find a word in the description by using LIKE '%window%' and then you can join the two tabes if you need the category from the category table. Quote Link to comment https://forums.phpfreaks.com/topic/134224-solved-mysql-newcomer-help/#findComment-698688 Share on other sites More sharing options...
lill77 Posted November 25, 2008 Author Share Posted November 25, 2008 Thanks would that be someting like $query = "SELECT * FROM `products` ORDER BY 'CAT' ASC"; an $query = "SELECT * FROM `category` ORDER BY 'CAT' ASC"; ? Quote Link to comment https://forums.phpfreaks.com/topic/134224-solved-mysql-newcomer-help/#findComment-698695 Share on other sites More sharing options...
lill77 Posted November 25, 2008 Author Share Posted November 25, 2008 Im getting myself confussed. I need to save products by two ways cat and by product so it would be a Cushion that belongs to say . . M&S. So then I could pull the info in by product eg cushion and or by M&S. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/134224-solved-mysql-newcomer-help/#findComment-698709 Share on other sites More sharing options...
revraz Posted November 25, 2008 Share Posted November 25, 2008 You only save it one way. You have two tables, one that has your Category Name with a ID, and one that holds Products. Your Product holds the category_id it belongs to. So you really only need to query the product table, and join the category table if you want the category name. Quote Link to comment https://forums.phpfreaks.com/topic/134224-solved-mysql-newcomer-help/#findComment-698717 Share on other sites More sharing options...
lill77 Posted November 25, 2008 Author Share Posted November 25, 2008 Great thanks i WILL see how I go ! Quote Link to comment https://forums.phpfreaks.com/topic/134224-solved-mysql-newcomer-help/#findComment-698736 Share on other sites More sharing options...
lill77 Posted November 26, 2008 Author Share Posted November 26, 2008 Hello im back again. So I gather that i can show products by type eg duvet set or fleece or pillow etc... and also show by make of the product, with the way im saving the info in my database. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/134224-solved-mysql-newcomer-help/#findComment-699455 Share on other sites More sharing options...
revraz Posted November 26, 2008 Share Posted November 26, 2008 You can show it by any field you desire. Quote Link to comment https://forums.phpfreaks.com/topic/134224-solved-mysql-newcomer-help/#findComment-699487 Share on other sites More sharing options...
lill77 Posted November 26, 2008 Author Share Posted November 26, 2008 Thanks It is better the save the info into a field that is most common eg product, and then search by make ? Do you know of any links to how to do this eg. help or tutorial ?? Thanks for your help Rich Quote Link to comment https://forums.phpfreaks.com/topic/134224-solved-mysql-newcomer-help/#findComment-699559 Share on other sites More sharing options...
revraz Posted November 26, 2008 Share Posted November 26, 2008 See if this helps http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html Quote Link to comment https://forums.phpfreaks.com/topic/134224-solved-mysql-newcomer-help/#findComment-699579 Share on other sites More sharing options...
lill77 Posted November 26, 2008 Author Share Posted November 26, 2008 thanks again Rich Quote Link to comment https://forums.phpfreaks.com/topic/134224-solved-mysql-newcomer-help/#findComment-699587 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.