close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

retrieving a particular record from a database

Thread began 1/27/2015 10:44 am by Christopher West | Last modified 1/27/2015 12:47 pm by Christopher West | 2332 views | 7 replies

Christopher WestCommunity Expert

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:
<?php

$rsSiteSettings 
= new WA_MySQLi_RS("rsSiteSettings",$sitedb,1);
$rsSiteSettings->setQuery("SELECT * FROM settings");
$rsSiteSettings->execute();
?>



therefore the binding would be:

php:
<?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:
<?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

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...