heartsblack Posted September 24, 2015 Share Posted September 24, 2015 I want fetch columns of the mysql database table into a selectbox and then transfer the columns into another table which is in another select box. Quote Link to comment https://forums.phpfreaks.com/topic/298300-fetch-columns-of-the-mysql-database-table-into-a-selectbox/ Share on other sites More sharing options...
Barand Posted September 24, 2015 Share Posted September 24, 2015 So what? I want to win the lottery. Why don't you stop posting your "wish list" and try asking a question, preferably with some detail and current code. You have a very similar post here http://forums.phpfreaks.com/topic/298261-transfer-data-from-one-select-box-to-another/ Quote Link to comment https://forums.phpfreaks.com/topic/298300-fetch-columns-of-the-mysql-database-table-into-a-selectbox/#findComment-1521472 Share on other sites More sharing options...
heartsblack Posted September 24, 2015 Author Share Posted September 24, 2015 How to I display the columns of the table in a database into a select box? I don't have any code Quote Link to comment https://forums.phpfreaks.com/topic/298300-fetch-columns-of-the-mysql-database-table-into-a-selectbox/#findComment-1521474 Share on other sites More sharing options...
Barand Posted September 24, 2015 Share Posted September 24, 2015 try $sql = "SHOW COLUMNS FROM tablename"; $res = $mysqli->query($sql); echo "<select name='column_names'>"; while ($row = $res->fetch_row()) { echo "<option>{$row[0]}</option>"; } echo "</select>\n"; Quote Link to comment https://forums.phpfreaks.com/topic/298300-fetch-columns-of-the-mysql-database-table-into-a-selectbox/#findComment-1521482 Share on other sites More sharing options...
benanamen Posted September 24, 2015 Share Posted September 24, 2015 The jist of your request doesn't make much sense. What are you trying to accomplish overall? Quote Link to comment https://forums.phpfreaks.com/topic/298300-fetch-columns-of-the-mysql-database-table-into-a-selectbox/#findComment-1521490 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.