Alright, my question should be pretty simple.
I have a database with various networking information (specific to a unique computer name).
Anyway, this is the code I am using to retrieve the data to pull out the information:
$query="SELECT networking.ip, networking.subnet, networking.gateway, networking.internet_access,
networking.nic_mac
FROM networking
WHERE networking.computer_name='$computer'";
and this is how it is displayed:
// Now, put a basic header that shows the computer name (taken directly from the user input).
print "<table>\n";
print "\t<tr>\n";
print "\t\t<td align=\"center\">$computer</td>\n";
print "\t</tr>\n";
print "</table>\n";
// Now, let's retrive the data from the database and also put them in a table.
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"; //move below the } (right below this line) to have each column as a cell (column)
}
}
print "</table>\n";
print "</td>\n";
print "</tr>\n";
// The table is closed, and done.
Sorry about the bad formatting of the code.
Anyway, this will result in the data alone being retrieved. I would like to be able to display the column name as well. I could alter the select statement to retrieve the columns AS something more user friendly, but how would I go about displaying that information.
The query above will display the information in a table, with each column actually becoming a row in a table.
It would be nice to display something like this:
Computer Name
IP Address: [address]
Subnet: [subnet]
etc.