Ready to get started?Download WordPress

Plugin Directory


MySQL interface. Create forms to insert, update and search. Embed tables or single values into pages. Foreign keys. Password records. Send email.

What is the ABASE shortcode?


Putting "[abase]" on a page will display the current ABASE version, the default database, default user and a list of all the accessible database tables. Add attributes to access MySQL databases, create forms, display tables, and create Internet database applications in WordPress.

What are all these attributes? Where's a ABASE reference guide?

From the Details screen before you install ABASE, complete shortcode and attribute documentation can be found in the Description section. Once installed, from the WordPress Admin section, click Settings on the left, and then "ABASE for MySQL." This is also where you set the database and user. Below that is the most up-to-date reference guide for ABASE.

How do I know that ABASE is installed properly?

In the WordPress Admin section, clicking Settings on the left, then "ABASE for MySQL" will show the configuration settings. This confirms the installation.

Another way is to place the shortcode [abase] in a page or post and it will display the current user and database settings. If the database contains any tables, their names and record counts are listed.

How many ABASE shortcodes can I use on the same page?

There is no limit. Note that a shortcode [abase] is different than [ABASE]. This is important if you embed an ABASE shortcode within another, e.g., [ABASE] ... [abase /] ... [/ABASE] works.

Where do I set the database and user?

In the WordPress Admin menu, click Settings on the left, and the ABASE for MySQL.

How do I create a new database?

This step is performed outside ABASE. If you have cPanel, you can create a new database using the MySQL Databases or MySQL Database Wizard cPanel applications. Otherwise you can use the default WordPress database and create your own tables using the SQL CREATE TABLE statement.

I've created a new database but [abase] connects to a different database. Where do I change this?

ABASE can connect to up to 3 databases. You change or add a database in the WordPress dashboard by clicking Settings on the left, then clicking on ABASE for MySQL. ABASE defaults to the first database. If no database is specified, it defaults to the WordPress database. If no user is specified it defaults to the WordPress user. It is recommended that you create your own database not use the WordPress database. You can create your database and give the WordPress user access using the MySQL Create Database application. To connect a second or third database you may need to Expand to full settings first.

ABASE shortcodes default to using database 1. A db="1", db="2" or db="3" attribute in a shortcode will specify a specific database to use AND change the default database for the remaining shortcodes on the page. Therefore if the page uses database 2, you only need to specify [abase db="2"] in the first shortcode. Shortcodes [abase2 ...] will use the database 2 regardless of the default, and will not change the default. Shortcode [abase3 ...] will use database 3 and not change the default.

How do I create a new table?

You can use phpMyAdmin, which is available in cPanel. You can also use the CREATE TABLE SQL statement in an ABASE shortcode using the sql="?" attribute.

For example, shortcode:

[abase sql="CREATE TABLE employees (employee_id int(11) NOT NULL AUTO_INCREMENT, first_name varchar(100) NOT NULL, last_name varchar(100) NOT NULL, PRIMARY KEY (employee_id))"]

will create a table named 'employees' in the current database, with a primary key ID field named 'employee_id' and a first name field named 'first_name' and a last name field named 'last_name'. The primary key is autoincrement and the first and last names can each be up to 100 characters long.

How do I display a table?

There are different ways, depending on what you want to display.

[abase table="employees"] will display all the columns and all records in the employees table. If there are any foreign keys columns from those tables will also be displayed.

[abase table="employees" columns="first_name,last_name" ORDER="last_name,first_name"] will display only the first and last name columns in alphabetical order by last name.

[abase sql="SHOW COLUMNS FROM employees"] will display the structure of the employees table.

[abase sql="SHOW CREATE TABLE employees"] will display the SQL CREATE statement to create the table.

How do I add a Title field that is a foreign key into a Titles table?

To make the Title come from a separate Titles table, create your Titles table so it uses the InnoDB storage engine.

[abase sql="CREATE TABLE titles (title_id int(11) NOT NULL AUTO_INCREMENT, title_name varchar(50) DEFAULT NULL, PRIMARY KEY (title_id)) ENGINE=InnoDB"]

Make your employees table InnoDB also and add the column that will contain the foreign key.

[abase sql="ALTER TABLE employees ENGINE = INNODB"] [abase sql="ALTER TABLE employees ADD title_key INT NOT NULL, ADD INDEX ( title_key )"]

Finally, set the foreign key relationship.

[abase sql="ALTER TABLE employees ADD FOREIGN KEY ( title_key ) REFERENCES titles (title_id) ON DELETE RESTRICT ON UPDATE RESTRICT"]

How do I create a form to add a record to a table?

[abase form="1,insert" table="employees" columns="first_name,last_name$Add Employee" elements="first_name,last_name" ack="red"]

The form attribute specifies a form to insert records, and the "1" indicates this form consists of only 1 shortcode (this one). The elements attribute specifies which fields are form input elements and the columns attribute specifies which fields are displayed and their formatting. The "$Add" specifies the submit button following the color field, with "Add" being the button text. The elements attribute specifies the first_name and last_name fields will be form input elements. The ack attribute requests an acknowledgement be displayed in red when data is inserted.

How do I change the sizes and types of the input elements in a form?

Formatting takes place in either the columns, fields or cols attribute. Changing the title of a column precedes the name with a carrot (^) character. Element formatting follows the name with an exclamation point (!) in single quotes ('). Within the single quotes can begin optionally with the type of form element followed by a space, then either (a) 1, 2 or 3 integers separated by semicolons, or (b) contents of an HTML style attribute. 1 to 3 integers correspond to width, height and vertical-align values in pixels. An HTML style attribute can specify width, height, vertical-align, font-size, font-family, and anything else. For example,

[abase form="1,insert" table="employees" columns="first_name!'width:100px;font-size:12pt;',Password^last_name!'password 100;15'$Add Employee" elements="first_name,last_name" ack="red"]

The format of the first name field will be a text box 100 pixels wide and the font size will be 12 point. The height defaults to 18 pixels. The last name field will be renamed on the form "Password" and the form element will be a password type (so what is typed on the screen is hidden). The password form element will be 100 pixels wide and 15 pixels in height.

How do I create a search form?

To specify a search form using ABASE, you will use at least the table="?", columns="?", elements="?" and form="?" attributes. If you would like your search results to appear on the same page, you do not need to specify the URL page of the search results in the form="" attribute.

[abase form="1,search" table="employees" columns="first_name,last_name$Search Employees" elements="first_name,last_name"]

In this example, if the search results were to appear on a different page, the form="" attribute will be form="1,search,/search-results/" where /search-results/ addresses the search results page.

On the searh results page, place the following shortcode to display a table with the results of the search. This example shows the use of the optional where="" attribute to restrict the search to records with status='1'. With the optional attribute echo="0" the user can view the page source and see the complete SQL statement for the search in the HTML comments.

[abase table="employees" columns="first_name,last_name" where="AND status='1'" echo="0" ack="green"]

How do I create a form to update a record in a table?

First you need a way to identify the record you want to update. To do so, we can use the rlink attribute to specify the first name as a "record" link.

[abase table="employees" columns="first_name,last_name" rlink="first_name" echo="blue"]

The first name will appear as a link. Clicking on a link first name will re-display the page with the primary key and value in the query string. To create the form, place the following shortcode on the same page.

[abase form="1,update" table="employees" elements="first_name,last_name" fields="first_name,last_name$Update Employee" ack="brown" echo="blue"]

When a record identified by its primary key is in the query string, an update form for that record will be produced.

How do I send an email?

The execution results from a shortcode execution is sent as an email if there is a valid emailto="<email_address>" attribute is present. <email_address> can be either an actual email address or a column name that contains valid email addresses. If an email address is specified as a column, the email will be sent if the shortcode execution results in exactly one record. If the email is sent, the content will not display on the page.

To produce more readable email content, add a <content> field followed by a [/abase] closing shortcode, and <content> will appear before the original shortcode output.

For example, the following ABASE shortcode will send an email to xyz@123.45 that says "Hello Joe, how are you?"

[abase emailto="xyz@123.45"]Hello Joe, how are you?[/abase]

Replace xyz@123.45 with your email address and view the page with the shortcode. You should not see the email content on the page but you should get the email.

ABASE shortcodes can be placed within <content> as long as the ABASE shortcodes within <content> use "ABASE" if the email shortcode uses "abase" (or vice versa). So, for example, the following shortcodes will email the contents of the employee table:

[ABASE emailto="xyz@123.45"] Joe, here is the contents of the employee table: [abase table="employees"] Fred. [/ABASE]

How do I add a field to a table without using phpMyAdmin?

Use an SQL statement. For example, to add an integer field "employee_level" to the employees database, execute the following just once:

[abase sql="ALTER TABLE employees ADD employee_level INT NOT NULL"]

Once the page containing the shortcode is displayed (and the new field added to the table) then be sure to delete or disable the shortcode so it doesn't execute again.

How do I upload an image or PDF file?

File uploads are associated with a field in a database record. When uploading a file, the file is stored in a directory defined by the table name, column name and primary index. The address of the file (path and file name) is stored in the table cell defined by the table name, column name and primary index. The images or files attribute specify columns that correspond to file uploads.

For example, if we start by creating a table as follows with an employee first name, last name and picture:

[abase sql="CREATE TABLE employees ( employee_id int(11) NOT NULL AUTO_INCREMENT, first_name varchar(100) NOT NULL, last_name varchar(100) NOT NULL, picture varchar(250) NOT NULL, PRIMARY KEY (employee_id) )"]

A form to add an employee with the picture field identified as an image would produce a browser file upload form element for the picture entry:

[abase form="1,insert" table="employees" elements="first_name,last_name,picture" columns="first_name!'100',last_name!'100',picture!100$Add Employee" images="picture" ack="green"]

Displaying the employees table with pictures would be as follows:

[abase table="employees" columns="picture!'width:50px;vertical-align:-25px;',first_name,last_name" images="picture" style="width:500px;"]

The images attribute declares picture as an image. The exclamation point (!) precedes formatting for the image. width:50px will resize the image to 50 pixels wide and vertical-align:-25 will lower it 25 pixels so the adjacent rows will appear in the middle instead of at the bottom of the row.

How can I put individual passwords on table records?

A password on a record will prevent updates or deletions to the record without a password. In the shortcode declaring an update or delete form, include a password attribute identifying the column password. The password input must equal the contents of the password field for the update or delete to take place.

Requires: 3.3 or higher
Compatible up to: 3.9.1
Last Updated: 2014-5-14
Downloads: 4,141


5 stars
5 out of 5 stars


0 of 13 support threads in the last two months have been resolved.

Got something to say? Need help?


Not enough data

1 person says it works.
0 people say it's broken.

100,1,1 100,1,1
100,1,1 100,1,1 100,1,1 100,1,1 100,2,2 100,1,1 100,1,1
100,3,3 100,2,2