subash85 Posted June 11, 2009 Share Posted June 11, 2009 i have sql data which i've inserted from php to mysql and now i am trying to fetch data in my combo box.. can u really please help me... Quote Link to comment https://forums.phpfreaks.com/topic/161796-how-to-put-data-of-sql-in-combo-box/ Share on other sites More sharing options...
Daniel0 Posted June 11, 2009 Share Posted June 11, 2009 How about you make an attempt first and post your code here if you can't get it to work? We're here to help, not to do it for you. Quote Link to comment https://forums.phpfreaks.com/topic/161796-how-to-put-data-of-sql-in-combo-box/#findComment-853663 Share on other sites More sharing options...
subash85 Posted June 11, 2009 Author Share Posted June 11, 2009 i dun have any idea . i juz use...$insert_data="insert into to insert data in mysql but i dun know about how to display data in list/menu (combo) box.. soo..i m needed for help if u can anyone give me tutorials about list/menu (combo) box that how to fetch data of mysql in to php form type in combo Quote Link to comment https://forums.phpfreaks.com/topic/161796-how-to-put-data-of-sql-in-combo-box/#findComment-853664 Share on other sites More sharing options...
subash85 Posted June 11, 2009 Author Share Posted June 11, 2009 here's the cod which i have used for fetching the data to select box from the sql... <?php $query1="select * from type order by user_id"; $result1=mysql_query($query1); $i=0; while ($a_row=mysql_fetch_array($result1)) { global $i; $i++; $db_id=$a_row['id']; $db_user_type=$a_row['user_type']; print "<select name=\"new_user_type\" id=\"new_user_type\"> <option></option> <option>$db_user_type</option> </select> "; } ?> ....................... SQL CREATE TABLE `type` ( `id` int(11) NOT NULL auto_increment, `user_type` varchar(100) NOT NULL, PRIMARY KEY (`id`,`user_type`) ) Quote Link to comment https://forums.phpfreaks.com/topic/161796-how-to-put-data-of-sql-in-combo-box/#findComment-853680 Share on other sites More sharing options...
subash85 Posted June 11, 2009 Author Share Posted June 11, 2009 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in......... i got this error.. Quote Link to comment https://forums.phpfreaks.com/topic/161796-how-to-put-data-of-sql-in-combo-box/#findComment-853682 Share on other sites More sharing options...
haku Posted June 11, 2009 Share Posted June 11, 2009 If you learn to spell don't, I may consider helping you. 'Dun' is just annoying as hell. Quote Link to comment https://forums.phpfreaks.com/topic/161796-how-to-put-data-of-sql-in-combo-box/#findComment-853684 Share on other sites More sharing options...
subash85 Posted June 11, 2009 Author Share Posted June 11, 2009 If you learn to spell don't, I may consider helping you. 'Dun' is just annoying as hell. Sorry my shortcut english i m sorry! Quote Link to comment https://forums.phpfreaks.com/topic/161796-how-to-put-data-of-sql-in-combo-box/#findComment-853687 Share on other sites More sharing options...
J.Daniels Posted June 11, 2009 Share Posted June 11, 2009 You don't have a column called user_id in your database: $query1="select * from type order by user_id"; Quote Link to comment https://forums.phpfreaks.com/topic/161796-how-to-put-data-of-sql-in-combo-box/#findComment-853760 Share on other sites More sharing options...
subash85 Posted June 12, 2009 Author Share Posted June 12, 2009 thanks fren i did it.. Quote Link to comment https://forums.phpfreaks.com/topic/161796-how-to-put-data-of-sql-in-combo-box/#findComment-854224 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.