i have created a program that allows users to make custom sql queries to a mysql db and display the output to the browser. the program works as desired but what i would like to do is display the data in a table. as there can be up to 4 columns with up to 13 different titles, i cannot hard code this info in. i would like to have the title used in the query to the be the title of the table with the relevant data below in an easily read format.
here is a sample of my code can any one help??? function db_search(){ global $search,$search0,$search1,$search2,$search3,$where,$boulean,$variable; // from the subnet and the host make the ip address $ip_addr = $ip . $address; // check to see if the variable is empty and discard other wise add the contents to $field if(!empty($search)) { $field .= "$search, "; } if(!empty($search0)) { $field .= "$search0, "; } if(!empty($search1)) { $field .= "$search1, "; } if(!empty($search2)) { $field .= "$search2, "; } if(!empty($where)) { $field1 .= "$where "; } if(!empty($search3)) { $field1 .= "$search3 "; } if(!empty($boulean)) { $field1 .= "$boulean "; } if(!empty($variable)) { $field1 .= "'$variable' "; } //strip the last character off of $field $field = substr($field,0,strlen($field)-2); //$field1 = substr($field1,0,strlen($field1)-2); // prepare the query $sql = "select $field from machine $field1 "; print $field; // action the query $result = mysql_query($sql) or die ("Cannot do query, query = $sql"); // Printing results in HTML print "<table>\n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { print "\t<tr>\n"; foreach ($line as $col_value) { print "\t\t<td>$col_value</td>\n"; } print "\t</tr>\n"; } print "<hr width='100%'>"; print "</table>\n"; print "<hr width='100%'>"; echo "\n\n<center>Your Job has Completed</center>\n\n\n<a href=\"javascript:history.back();\">\n\n<center>Back</center></a>"; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]