vinaysnarayan Posted April 18, 2009 Share Posted April 18, 2009 Hi I have 17 fields (columns) in a mysql table. I have 6 text boxes. I want to populate the text boxes with the column data after I click the submit button. What query should I use? If I use the query - "select `column_name` from `table_name`", its returning empty values. How to do this? Please correct where i'm going wrong. Thanks, Vinay Quote Link to comment https://forums.phpfreaks.com/topic/154681-how-to-get-column-data-from-mysql-db/ Share on other sites More sharing options...
bloodgoat Posted April 18, 2009 Share Posted April 18, 2009 I've never worked with SQL before but I've learned a bit from threads... Wouldn't it make use of the asterisk as a wildcard? Something like: SELECT * from COLUMNNAME Quote Link to comment https://forums.phpfreaks.com/topic/154681-how-to-get-column-data-from-mysql-db/#findComment-813398 Share on other sites More sharing options...
fenway Posted April 20, 2009 Share Posted April 20, 2009 Say what? Quote Link to comment https://forums.phpfreaks.com/topic/154681-how-to-get-column-data-from-mysql-db/#findComment-814567 Share on other sites More sharing options...
jkewlo Posted April 20, 2009 Share Posted April 20, 2009 <? $sql="SELECT column_name, column_name, column_name, column_name, column_name, column_name FROM Table_name"; $result=mysql_query($sql); while( $rows = mysql_fetch_array($result)){ echo "". $rows['column_name'] .""; } ?> that should do the trick, replace column_name with your column names you are trying to call, also the table name Quote Link to comment https://forums.phpfreaks.com/topic/154681-how-to-get-column-data-from-mysql-db/#findComment-814801 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.