php - Best way of storing 'website settings' data in a database table? -
i working on marketplace, , wondering best way of handling website settings such title, url, if https, contact email, version, etc.
i trying structure table easy update, , able have more , more settings added fetch.
i developed 2 structures, either keep in 1 row, column names setting name, , row column value setting value. , echoing first row value column name mysql_fetch_assoc.
i thinking having new auto-increment row every setting. , turning array fetch database assign column name column im fetching of setting name.
what way of handling efficiently. thank you.
a row each distinct option setting, using name/value pairs 1 per row, best way go. it's more flexible lots of columns; if add option setting won't have run kind of alter table
operation.
the wordpress wp_options table works way. see here. http://codex.wordpress.org/options_api
if had "compound" option, serialize php array store in single row of table.
Comments
Post a Comment