Jump to content

Displaying colum names


rondog

Recommended Posts

hey guys im getting my column names with this query:

$query = mysql_query("SELECT column_name FROM information_schema.columns WHERE table_name = 'cam_systems'");

 

I then have an array:

$fields = array(
	"cfg_change_date" => "Configuration Change Date",
	"system_name" => "System Name",
	"system_manf" => "System Manufacturer",
	"system_model_no" => "System Model Number",
	"system_serial_no" => "System Serial Number",
	"system_board_part_no" => "System Board Part Number",
	"system_board_serial_no" => "System Board Serial Number",
	"asset_tag" => "Asset Tag",
	"sla_code" => "SLA Code",
	"category" => "Category",
	"os_version" => "OS Version",
	"os_upgraded" => "OS Upgraded",
	"bios_version" => "BIOS Version",
	"bios_upgraded" => "BIOS Upgraded",
	"ilom_version" => "ILOM Version",
	"ilom_ip" => "ILOM IP Address",
	"ilom_updated" => "ILOM Updated",
	"rack_id" => "Rack ID",
	"rack_location_id" => "Rack Location ID",
	"tech_id" => "Tech ID",
	"warranty" => "Warranty"		
);

 

I need to display these field names now, but rather than the actual column name, I've created an array with column name and then the name I want to actual display. How can I do that? Is their a better way I should be doing this?

Link to comment
https://forums.phpfreaks.com/topic/214254-displaying-colum-names/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.