Skorpio Posted June 9, 2013 Share Posted June 9, 2013 MySQL server version: 5.1.60-rel13.1 "SELECT `id`, `sub_topic`, `url`, `info` FROM `links No errors are being thrown. The structure of my database is visible here == Table structure for table links |------ |Column|Type|Null|Default |------ |//**id**//|int(11)|No| |topic|varchar(150)|No| |sub_topic|varchar(150)|No| |info|text|No| |url|varchar(255)|No| == Dumping data for table links Hi, after completing a dropdown tutorial I am trying to convert code for my purpose which is dropdown1 make selection from topics which upon valid selection triggers dropdown2 to be enabled and populate with subtopics then upon selection from dropdown2 (final choice) a textarea will be populated with the relevant information and hyperlink. The issue at the moment is that I am getting all information in sub_topics rather than the ones linked to the main topic selected in dropdown1 which means my statement is incorrect but I cannot work out what I am missing. I know what I want to do but not sure how to get it/write it. I have been working on this for several hours, my statement started out as SELECT * FROM `categories` WHERE `master` = ? from the tutorial to SELECT `id`, `topic`, `sub_topic`, `info`, `url` FROM `links` WHERE `id` = ? GROUP BY `topic` Reasoning for the GROUP BY was that I wanted to remove duplicates, for example I have 'web design' as a topic but this is same for over 20 records, I don't want 'web design' in the list 20+ times. I went through a few other statements before I got to "SELECT `id`, `topic`, `sub_topic`, `url`, `info` FROM `links Now this has meant that I am getting data populating the 2nd box and the trigger is enabling the box however now I am getting all the records (everything). I realise I have not got the statement right but cannot work out how to write it. Link to the code being used. The MySQL db I would appreciate it if someone could advise as to where I have gone wrong and possibly how I correct it so only the correct options show in the 2nd box. Thanks Quote Link to comment Share on other sites More sharing options...
Skorpio Posted June 9, 2013 Author Share Posted June 9, 2013 I now have the 2nd box functioning as expected however the third, a textarea is a whole other matter. If someone could steer me in the right direction I would appreciate it? Thanks The previous links to the code hold the updated code. Quote Link to comment Share on other sites More sharing options...
fenway Posted June 14, 2013 Share Posted June 14, 2013 Why not just select topic, sub_topic? Quote Link to comment 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.