saqib389 Posted July 10, 2006 Share Posted July 10, 2006 Hellocan any one tell me how can i retrive value from Database in SELECT form[code]<SELECT NAME="category">WHAT WILL BE THE SQL STATEMENT AND HOW TO WRITE HERE TO GET CATEGORY FROM DATABASE</SELECT>[/code]Database Tables Name and Field pa_categories category_id category_namepa_subcategory_category_map subcategory_id(parent category) category_id ( child category )please tell me how can i get value in Select form from data basethank you in advancewaiting for reply Quote Link to comment https://forums.phpfreaks.com/topic/14200-how-to-get-value-from-database-in-select-form/ Share on other sites More sharing options...
willfitch Posted July 10, 2006 Share Posted July 10, 2006 Your data structure is very confusing. It's even more confusing since you didn't provide any details on it. Lastly, this is phpfreaks.com, rather than mysqlfreaks.com. With that, maybe this is what you are looking for:SELECTpa_categories.category_name AS category_name1,/* parent category */pa_categories.cateogry_name AS category_name2 /* subcategory */FROM pa_categoriesLEFT JOIN pa_subcategory_category_map ON pa_categories.category_id=pa_subcategory_category_name.subcategory_id Quote Link to comment https://forums.phpfreaks.com/topic/14200-how-to-get-value-from-database-in-select-form/#findComment-55670 Share on other sites More sharing options...
redarrow Posted July 10, 2006 Share Posted July 10, 2006 If this is correct someone tell me ok.[code]<?database connection$query="select * from whatever where what_ever=$what_ever":$result=mysql_query($query);while($record=mysql_fetch_assoc($result) {?><form method="post" action="what_ever.php"><select name="whatever"><option value="<? echo $record['what_ever'];?>"><?echo $record['what_ever'];?></option></select><input type="submit" name="submit" value="send"></form><?}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/14200-how-to-get-value-from-database-in-select-form/#findComment-55672 Share on other sites More sharing options...
willfitch Posted July 10, 2006 Share Posted July 10, 2006 It would be redarrow, but I think he's having issues more on his SELECT statement. Take a look at that structure. Quote Link to comment https://forums.phpfreaks.com/topic/14200-how-to-get-value-from-database-in-select-form/#findComment-55676 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.