The New Stuff

Oxwall MySQL Database (OWSQL101): How to Add, Retrieve or Delete Values in Oxwall Config Database


This tutorial (or course, if you like) will guide you on how to add, retrieve and manipulate data stored in Oxwall config SQL database.

Oxwall SQL

If you are asking the same question as the user above – picture taken from the Oxwall forum – I have done my best to put together a simple tutorial that will guide you on how to accomplish just that.

What you need?

Depending on how you want to use this tutorial, you may want to glance through the Oxwall plugin crash course and quickly download the Oxwall Plugin Skeleton. This two items will prepare you on how to structure your plugin (I’m assuming you are developing a plugin).

Finally, get your code editor ready and dive into the next paragraph.

Structure of Oxwall Config

The Oxwall config values are stored in a MySQL database table named ow_base_config. This table contains all the Oxwall key information such as your site name, current theme, site email, etc. This is also the table we will be storing our custom config values.

To avoid conflicts and duplicate config names, each configuration is stored with its plugin key.

Check if Config Exists

Before adding a config record to the table, you can check if the config already exists using the configExists('string','string') function. This function returns true if the config exist or false if it doesn’t exist.


if (!OW::getConfig()->configExists('plugin_key', 'field_name')) {
    //Configuration does not exist. Add new config or do something else

The above code makes sure that the config ‘field_name’ belonging to a plugin with the key ‘plugin_key’ does not exist on the Oxwall config MySQL database before adding a new config (or some action).

Adding a Config to Oxwall MySQL Database

Adding items to the database should be performed on plugin installation. This section should be done on yourplugin/install.php file.

if (!OW::getConfig()->configExists('plugin_key', 'field_name')) {//Make sure config does not exist
    OW::getConfig()->addConfig('plugin_key', 'field_name', 'default_value');//Add this config.

Collecting Values using Oxwall Form

This part of the coding should be done on the page where users are suppose to input config values (for the config you added earlier). The example will create a text input box. The content of the input box will be stored in ‘field_name’ in ow_base_config.

PHP (backend) code:

$form = new Form('form_name');//An instance of form named 'form_name'. Give your form a name

$foo = new TextField('field_name');//Create instance of TextField input for 'field_name'
$foo->setLabel('foo_name');//Set input label name
$foo->setHasInvitation(true);//Do you want to show placeholder?
$foo->setInvitation('foo_example');//Placeholder text
$foo->setDescription('foo_desc');//Input description

$fooSave = new Submit('save');
$fooSave->setValue('fooSave');//Submit button text


Save Form Values to Oxwall Config Database

if ( OW::getRequest()->isPost() && $form->isValid($_POST) ){//Check if form is submitted and valid
    $data = $form->getValues();
    //Save form values to field_name in db
    OW::getConfig()->saveConfig('plugin_key', 'field_name', trim($data['field_name']));
    //Display some fancy success message and redirect (optional)
    OW::getFeedback()->info('Some success msg');

HTML (frontend) code:

{form name='form_name'}
    <table class='ow_table_1'>
        <tr class='ow_alt1'>
            <td class='ow_label'>{label name='field_name'}</td>
            <td class='ow_value'>{input name='field_name'}{error name='field_name'}</td>
            <td class='ow_desc'>{desc name='field_name'}</td>
    <div class="clearfix ow_submit ow_smallmargin">
        <div class="ow_right">
            {submit name='save' class='ow_button ow_ic_save'}

Pay specific attention to ‘form_name’ and ‘field_name’. field_name is the name of your database config and form_name, of course, is the name of your form (just give it any name).

Retrieve Config Value from MySQL database


$dbFoo = OW::getConfig()->getValue('plugin_key', 'field_name');

Modify Oxwall Config Values


OW::getConfig()->saveConfig('plugin_key', 'field_name','new_value');
The following two tabs change content below.

Ebenezer Obasi

Senior executive editor at EwtNet
A web developer, IT undergrad, terrible entrepreneur, internet freak and a man of a few other incongruous talents, Ebenezer has been writing on technology since 2012, and plans to do so until a few days before his ultimate fate: cryogenic preservation. If resurrected, he is likely to go back to writing on technology.

Recieve Free Email Updates!

Subscribe to get new updates instantly delivered to your inbox. Select the specific category you want to recieve updates on and enter your email address below.

*A confirmation message will be sent to you, login to your e-mail account and click on the confirmation link to start enjoying this service.

Get the latest news on your Android mobile, Download our Android App

Recently Published


Selena Gomez and 6 million other Instagram Accounts Hacked

A group of hackers used a bug earlier this week to scrape ...


EaseUS Free Data Recovery Wizard Lets you get back lost files

The concept of data recovery is fairly old among internet users. But ...


Darwin Life Aims to Impregnate 40 and Above Women with Designer Babies

Darwin Life is a new fertility clinic that aims to get women over ...

College Students - Online Jobs

16 Online Jobs that will Make You Real Money in College

Are you a college student who is need of extra cash? Not really, you ...

multiple accounts

How to Use Multiple WhatsApp and Social Media Accounts on your Android Device

Do you have two accounts for Messaging, tired to log in and out to ...


PayPal will Fully Accept Nigeria only when their US Allies has Ignored them

After waiting for a little over a decade, PayPal arrived Nigeria in ...


Recharge your MTN Airtime Anytime Directly from your Bank Account

MTN On Demand will let you top up your MTN airtime balance anytime ...


MTN DND: Stop Unwanted SMS from your Network Provider

Stop unnecessary and promotional messages from MTN Nigeria by ...


Awale, Backgammon and 1 other Game Technology has transformed

From time memorial, man has indulged himself into seeking out ways to ...


Leave a Reply