Most config table's look like this example from phpBB:
CREATE TABLE nuke_bbconfig (
config_name varchar(255) NOT NULL default '',
config_value varchar(255) NOT NULL default '',
PRIMARY KEY (config_name)
);
#
# `bbconfig`
#
INSERT INTO nuke_bbconfig VALUES ('config_id', '1');
INSERT INTO nuke_bbconfig VALUES ('board_disable', '0');
INSERT INTO nuke_bbconfig VALUES ('sitename', 'MySite.com');
INSERT INTO nuke_bbconfig VALUES ('site_desc', '');
INSERT INTO nuke_bbconfig VALUES ('cookie_name', 'phpbb2mysql');
INSERT INTO nuke_bbconfig VALUES ('cookie_path', '/');
INSERT INTO nuke_bbconfig VALUES ('cookie_domain', 'MySite.com');
With field names such as config_name and config_value how do I select data from this table?
Something like the following from a table I built returns nothing.
"sitename" is not a field name in my table but one of the values for config_name.
$result = $db->sql_query("SELECT * FROM " . CONFIG_TABLE . "");
$info = $db->sql_fetchrow($result);
if (!$result) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
}
$disable_site = $info['disable_site'];
$sitename = $info['sitename'];
$site_desc = $info['site_desc'];
$cookie_name = $info['cookie_name'];
$cookie_path = $info['cookie_path'];
$cookie_domain = $info['cookie_domain'];
I was always confused by the use of these types of tables.