retrieving a particular record from a database
Hi, been some time, and just have a quick question, I have a table in the database called 'sitesettings' which store generic information such as website email address, phone number, address, meta title tag and meta description.
the table is as follows:
<?php
$rsSiteSettings = new WA_MySQLi_RS("rsSiteSettings",$sitedb,1);
$rsSiteSettings->setQuery("SELECT * FROM settings");
$rsSiteSettings->execute();
?>
therefore the binding would be:
<?php echo($rsSiteSettings->getColumnVal("settingscontent")); ?>
However how could I use the above binding so that for example in my HTML head I want place this binding inbetween: <title></title>
database table is:
settingsid
settingselement
settingscontent
and the first record the data is:
element = title
content = some random title for seo title demonstration
I tried doing it as an IF statement but even though it works when I used it for the title tag in my html, it doesnt work for the description metatag (is as though the record isnt moving onto the next so the IF statement lookup doesnt become true:
<?php
if ("".($rsSiteSettings->getColumnVal("settingselement")) ."" == "title") { // WebAssist Show If
?>
<?php echo($rsSiteSettings->getColumnVal("settingscontent")); ?>
<?php
} // ("".($rsSiteSettings->getColumnVal("settingselement")) ."" == "title")
?>
Since I be using this database table to store quite a bit of information relating to the website, I be using this data quite a bit on the page so wondered if there is a shorthand approach when adding a record binding to my html?
Regards
Chris