Hi
I have a task that a user provides a text file with a list of mysql column names from a table. I need to select and display the results from the selected columns. the column names vary each time they are provided. I have decided to load the column name list to an array and would like to use this to echo out the columns. I have made an attempt at this below but I'm not sure how to make it work.
Any help would be appreciated.
//load patient list to array $file = fopen("upload/PatList.txt", "r"); $all_pats = array(); while (!feof($file)) { $all_pats[] = fgets($file); } fclose($file); //var_dump($all_pats); } // select columns from array elements $qry=mysql_query("SELECT * FROM mytable", $con); while($row=mysql_fetch_array($qry)) { echo "<td>".@$row{$column_name}. "<br></td>"; }