It's simple the way SIMPLE should be.

Simple-ConnectDB is a quick and simple way to put any basic mySql database on line.

Simply edit the pre made db_Config.php template with your settings

For a basic database, about 5 minutes and Whow! it's on line

All that is needed to put it online are these five(5) lines

		  $db_user = ´root´;
		  $db_password = ´muffin´;
		  $db_Name = ´sakila´;
		  $db_Table = ´customer´;
		  $db_port = ´3307´; //optional
		  

This will display all Records, all Fields and a View link to view that Record

I built this application using Bootstrap, Xpeditable, TableSorter and fancybox along with meekroDB for the mySQL connection. (still needed is meekroDB implemented on the add new record, I had to use the old mySQL connection type until I can figure this out.

Please see their web sites for the license and rights for your use.

Here are some of the additional Options you can activate

This is only a strat of the options included

  • Theme's
  • List View
  • Record View
  • Add New Records
  • Delete Records
  • Set the Fields to View
  • Set the Fields to Add
  • Set the Fields to Edit
  • Define your owm Field Names
  • Set the Field Types - text. textarea, email, date, combodate, select, password, url, number, range, checklist, typeahead, wysihtml5. select2
  • Groups
  • Inline Edit
  • Set which Fields to Inline Edit
  • Child row with and with out template (template requires editing)
  • Display Images
  • Resizable columns
  • Filters
  • Can View option
  • Can Edit option
  • Can Delete option
  • Can Add option
  • Page Size
  • Start Page
  • Order by
  • Where clause
  • Column Sort
  • Widget Options
  • Language file (requires editing)
  • And More

For Deatil settings, look at each of them in the Documentation

Download the Zip (all-in-one)

Then read the simple installation in Step 3

Download

SIMPLE

QUICK SETUP

1) Download the Simple-ConnectDB application.
2) UnZip it to a working folder on your harddrive.
3) Run The customers.sql file located in the root of the application.
    It will creat a database named A1-Sales and a table named customers
    with some example data.
4) Open the config.php located in the includes folder with a good text editor.
    Set the user name, password and port # to your mySQL server.
    Then save it back to the same location.
		// Database Connection
		$db_user = 'user';
		$db_password = 'password';
		$db_Name = 'a1-sales';
		$db_Table = 'customers';
		$db_port = '3307';   // Change to match the port # for your mySQL
		
5) Open the MySQLConnect.php located in the root folder with a good text editor.
    Set the user name, password and port # to your mySQL server.
    Then save it back to the same location
    Once I figure out the adding a new record throught meekroDB this will go away.
		define('DB_SERVER', 'localhost:3307');
		define('DB_USER', 'user');
		define('DB_PASS', 'password');
		define('DB_NAME', 'a1-sales');
		define('DB_TABLE', 'customers');
		
6) Upload the complete Simple-ConnectDB folder to the root of your web./h5>
7) Browse to http://localhost/Simple-ConnectDB/index.php
    If all is correct the example application will appear in your browser.

USING YOUR DATABASE

The db_Config.php

GO THROUGH EACH SETTING BEFORE YOU START.

THIS WAY YOU WILL KNOW HOW TO SET EACH SETTING WITH THE OTHER SETTINGS

When the setting says OPTIONAL it is not required in the config.

However, if it has an * in front of it like this (*OPTIONAL).

Then it is required for the settings listed below it marked with a bullet like this 1-1 or 1-1

1 Connectiong to Database (REQUIRED)

This is the only Required settings to display your project

		// Set the mySql connection
		$db_user = ´user´;
		$db_password = ´password´;
		$db_Name = ´a1-sales´;
		$db_Table = ´customers´;
		$db_port = ´3307´;  // optional(only to connect other than port 3306
		

2 Sets the Main Title (OPTIONAL - defaults to TableName)

		$appTitle = ´Customers´;
		

3 Theme (OPTIONAL - defaults to blue)

Options: blue, green, bootstrap, dropbox, dark, ice, black-ice, default and grey

		$appTheme = ´green´;
		

4 Set the Widget Options (OPTIONAL)

Options = filter, columns, resizable

If Not Set then filter,columns abd resizable are disabled

		$db_WidgetOptions = "´filter´,  ´resizable´";
		

5 Set the Where in SQL (Optional)

%s = string
%i = integer
%d = decimal/double
%ss = search string (string surrounded with % for use with LIKE)

		$db_Where = ´LastName=%s,Jones´;
		

6 Sets the Default Order by in the SQL (OPTIONAL)

See $db_ColumnSort in the next setting

		$db_OrderBy = "CompanyName";
		

7 Sets the Columns to Sort On (OPTIONAL)

This overrides the $db_OrderBy

0 = 1st columnm, 0 - asc and 1 - desc

This overrides the $db_OrderBy

default = "0,0"

if columns are set in widget then you will get highlighting on the sorted columns.

List in order of the column sorted

example sort on column 3 then column2 column = "[3,0],[2,0]"

		$db_ColumnSort = "[2,0],[1,0]";
		

8 Set the Page Size (OPTIONAL)

If not set the default is 10

		$db_PageSize = 5;
		

9 Set the Start Page (OPTIONAL)

This is the Page # to start on

		$db_StartPage = 0;
		

10 Set the Pager Selector (OPTIONAL)

any # 1 to etc. and all=2000 rows

		$db_PageSelector = "5,10,15,20,50,100,ALL";
		

11 Enable Pager (OPTIONAL)

Defaults to 1 if not set in config

0 = NO Pager, 1 = Display on Top, 2 = Bottom

		$db_Pager = 3;
		

12 Set User definded Field Names (OPTIONAL)

If not set, than the field names will default to the database field names.

		$strFieldNames = "ID,COMPANY,FIRSTNAME,LASTNAME,ADDRESS,CITY,STATE,ZIP";
		

13 Set the Field Types (OPTIONAL)

REQUIRED FOR Inline Edit, Edit Record and Adding New Records.

If not set than all fields are considered text fields.

The ones with four ****´s require $arrSelect or $arrSelect2 settings explained below.

text.
textarea,
email, validation only
date,
combodate,
select, ****
password,
url, validation only
number, 0- etc.
range, slider 0-100
checklist, ****
typeahead, ****
wysihtml5.
select2, ****

		$strFieldType  	= ´text,select,text,typeahead,email,checklist,date,wysihtml5´;
		

14 Define the Select options for adding and editting records

The field must be set to select in $strFieldType (above)

Make sure you define $arrSelect as an array

		$arrSelect = array();
        // Then set these to the fields you need them on
		$arrSelect[1] = "{´´: ´Select Company´, ´A1-SALES´: ´A1-SALES´, ´A2-SALES´: ´A2-SALES´, ´A3-SALES´: ´A3-SALES´}";
		$arrSelect[12] = "{´´: ´Select Sales Rep´, ´Chuck´: ´Chuck Simple´´Kevin´: ´Kevin Lewis´}";
		$arrSelect[16] = "[{value: ´1´, text: ´Level-1´}, {value: ´2´, text: ´Level-2´}, {value: ´3´, text: ´Level-3´}]";
		$arrSelect[17] = "[{value: ´Red´, text: ´Red´}, {value: ´White´, text: ´White´}, {value: ´Blue´, text: ´Blue´}}]";
		$arrSelectValue[17] = "";
		$arrSelect[18] = "{´´: ´Select´, ´Active´: ´Active´, ´Non-Active´: ´Non-Active´, ´Vaccation´: ´Vaccation´}";
		

15 Define typeahead Options for adding and editting records

		$arrSelect[7] = "[{value: ´AL´, text: ´Alabama´},{value: ´AK´, text: ´Alaska´},{value: ´AZ´, text: ´Arizona´},{value: ´AR´, text: ´Arkansas´},{value: ´CA´, text: ´California´},{value: ´CO´, text: ´Colorado´},{value: ´CT´, text: ´Connecticut´},{value: ´DE´, text: ´Delaware´},{value: ´FL´, text: ´Florida´},{value: ´GA´, text: ´Georgia´},{value: ´HI´, text: ´Hawaii´},{value: ´ID´, text: ´Idaho´},{value: ´IL´, text: ´Illinois´},{value: ´IN´, text: ´Indiana´},{value: ´IA´, text: ´Iowa´},{value: ´KA´, text: ´Kansas´},{value: ´KT´, text: ´Kentucky´},{value: ´LO´, text: ´Louisiana´},{value: ´ME´, text: ´Maine´},{value: ´MD´, text: ´Maryland´},{value: ´MA´, text: ´Massachusetts´},{value: ´MI´, text: ´Michigan´},{value: ´MN´, text: ´Minnesota´},{value: ´MS´, text: ´Mississippi´},{value: ´MO´, text: ´Missouri´},{value: ´MT´, text: ´Montana´},{value: ´NE´, text: ´Nebraska´},{value: ´NV´, text: ´Nevada´},{value: ´NH´, text: ´New Hampshire´},{value: ´NJ´, text: ´New Jersey´},{value: ´NM´, text: ´New Mexico´},{value: ´NY´, text: ´New York´},{value: ´ND´, text: ´North Dakota´},{value: ´NC´, text: ´North Carolina´},{value: ´OH´, text: ´Ohio´},{value: ´OK´, text: ´Oklahoma´},{value: ´OR´, text: ´Oregon´},{value: ´PA´, text: ´Pennsylvania´},{value: ´RI´, text: ´Rhode Island´},{value: ´SC´, text: ´South Carolina´},{value: ´SD´, text: ´South Dakota´},{value: ´TN´, text: ´Tennessee´},{value: ´TX´, text: ´Texas´},{value: ´UT´, text: ´Utah´},{value: ´VT´, text: ´Vermont´},{value: ´VA´, text: ´Virginia´},{value: ´WA´, text: ´Washington´},{value: ´WV´, text: ´West Virginia´},{value: ´WI´, text: ´Wisconsin´},{value: ´WY´, text: ´Wyoming´}]";

	    OR

	    $arrSelectgroups[8] = "includes/groups/groups.php"; //see setting groups below
		

16 Define group Options for adding and editting records

The # between the [] is the field number

		$arrSelectgroups[8] = "includes/groups/groups.php";
		

Name this file to match the group file name set in the group settings

Save this file in the includes/groups folder

Script outputs data in json format, suitable for ´source´ option in X-editable

		<?php
		sleep(1);
		$groups = array(
		array(´value´ => ´37010´, ´text´ => ´ADAMS TN 37010´),
		array(´value´ => ´37011´, ´text´ => ´ANTIOCH TN 37011´),
		array(´value´ => ´37012´, ´text´ => ´ALEXANDRIA TN 37012´),
		array(´value´ => ´37013´, ´text´ => ´ANTIOCH TN 37013´),
		array(´value´ => ´37014´, ´text´ => ´ARRINGTON TN 37014´),
		array(´value´ => ´37015´, ´text´ => ´ASHLAND CITY TN 37015´),
		array(´value´ => ´37016´, ´text´ => ´AUBURNTOWN TN 37016´),
		array(´value´ => ´37018´, ´text´ => ´BEECHGROVE TN 37018´),
		array(´value´ => ´37019´, ´text´ => ´BELFAST TN 37019´),
		array(´value´ => ´37020´, ´text´ => ´BELL BUCKLE TN 37020´),
		array(´value´ => ´37022´, ´text´ => ´BETHPAGE TN 37022´),
		array(´value´ => ´37023´, ´text´ => ´BIG ROCK TN 37023´),
		);
		echo json_encode($groups);
		?> >
		

17 Define Select2 Options for adding and editting records(OPTIONAL)

The # between the [] is the field number

This settinf allows you to just Type in the input box and then select that tag

		$arrSelect2[20] = "[´html´, ´javascript´, ´css´, ´ajax´]";
		

User can also enter his own tag as well as from the list

OR $arrSelect2[20] = ´[{id: "EN", text: "EN"}, {id: "RU", text: "RU"}, {id: "GB", text: "GB"}]´;

17-1 MaxSelection2 in Select2 (OPTIONAL)

Limits the number of Selection you can have

		$MaxSelection2[20] = 2;
		

17-2 MinInputLength2 in Select2 (OPTIONAL)

Makes user enter a character for the selection

1 = User has to enter 1 character

2 = User has to enter 2 character

when entering the character a list will be displayed if a character match is made from $arrSelect2

		$MinInputLength2[20] = 1;
		

17-3 MaxInputLength2 in Select2 (OPTIONAL)

Max # of characters you can enter

If user enters more characters than the # set. It tells them to enter less characters and disables the enter option

		$MaxInputLength2[20] = 1;
		

17-4 AutoTokenSeparators2 in Select2 (OPTIONAL)

supports ability to add choices automatically as the user is typing into the search field. This is especially convenient in the tagging where the user can quickly enter a number of tags by separating them with a comma or a space.

		$AutoTokenSeparators2[20] = 1;
		

17-5 CustomMatcher22 in Select2 (OPTIONAL)

Matches options only if the term appears in the beginning of the string as opposed to anywhere in the string

		$CustomMatcher2[20] = "yes";
		

18 Show icons for VIEW,EDIT,DELETE (OPTIONAL)

defaults to 1 to show as Text

0 = Text. 1 = Buttons

		$dbButtons = 1;
		

19 Set if can View Records (OPTIONAL)

Defaults to 1 to show link

1 = Alows and shows a link on the right side of the row.

0 = Hide the link and don't allow View Record

		$dbCanView =
		

20 Set if can Edit Records (Optional)

Defaults to 0 - Can Not Edit Record

Required if you want to edit the record

1 = Alows and shows a link on the right side of the row.

0 = Hide the link and don't allow Edit Record

You can still enable inline editting. See settings for $strDisplayInlineEdit

		$dbCanEdit = 1;
		

21 Set if can Add Records (OPTIONAL)

Defaults to 0 - Can Not Add New Record

1 = Alows and shows a link on the right side of Pager

0 = Hide the link and don't allow Add Record

		$dbCanAdd = 1;
		

22 Set if can Delete Records (OPTIONAL)

Defaults to 0 - Can Not Delete Record

1 = Alows and shows a link on the right side of the row.

0 = Hide the link and don't allow Delete Record

		$dbCanDelete = 1;
		

23 Sets a Field to Display as an Image (OPTIONAL)

Only the path and image name is stored in the database field

The Image Field Name in the database MUST be Named 'IMGPhoto'

This only allows one image per record to be displayed

The next version will allow multi inages

		$db_ImageFieldName = "IMGPhoto";
		

24 Set the Fields to Display for LIST and Child Rows (OPTIONAL)

Default is 1 - Must be set if usinf Inline Edit or Child Rows

Note: If $strDisplayList NOT SET IN CONFIG all records will show

If Using a Child Row refer to $db_ChildTemplate and $ChildRowHeader

The Fields on the Child Row must also be fields from the parent $db_Name and $db_Table

This option is great for rows that have many fields

It enables you to still display them in the child row (no inline edit)

Set the Field Display option from the chart below

Note: the 1st Field # is 0

Note: Child Rows are not editable in this version

Note: If not using the Child Row then only use option 0 and 1

0 = No Show
1 = Show on Table List only
2 = Show on Table List as the Link to Child Row
3 = Show on Child Row only
4 = Show on Table List and Child Row

		$strDisplayList = "244430333310000000013"
		

25 Set the Fields to View when Viewing a Record (OPTIONAL)

Defaults to 1 - All Fileds Show in View

This allows you to hide certain Fields for security etc.

0 = No Show

1 = Show

		$strDisplayView  = "01111110001011111111";
		

26 Set the Fields to view and edit (OPTIONAL)

This allows you to hide certain Fields for security etc.

Defaults to 1 - All Fields are set as a popup

0 = No Show

1 = Show and is Editable with a popup edit

2 = Show and is Editable with inline edit

3 = Shows but Not Editable

		$strDisplayViewEdit = "02112222221221222222"
		

27 Set the Fields allowed for Inline Edit (OPTIONAL)

Defaults to 1 as a popup

0 = Field is not editable

1 = Field is Editable with a popup edit

2 = Field is Editable with inline edit

		$strDisplayViewEdit = "02112222221221222222"
		

28 Set the Fields that will show when adding a new record (OPTIONAL)

Defaults to 1 as a popup

$dbCanEdit = 1; must be enabled for the add link to show

0 = Field is not editable and will not show

1 = Field is Editable with a popup edit

2 = Field is Editable with inline edit

		$strDisplayAdd = "02112222222122122222"ot;
		

29 Set Field to be Required when Adding/Editting (OPTIONAL)

$dbCanEdit = 1; must be enabled for this feature

It will Display a red * by the Field Name when Adding a new record

0 = Field is not Required

1 = Field is Required

		$strRequired = "01110000000000000000";
		

30 Set the Columns that are Sortable (OPTIONAL)

Defaults to Sort on all Column

0 = Field is not Sortable

1 = Field is Sortable

		$strSortable = "11110011100011011110";0000";
		

31 Set the Columns that are Resizable (OPTIONAL)

Defaults to No Resize of Columns

0 = Field is not Resizable

1 = Field is Resizable

		$strResizable = "11110011100100100000";
		

32 Set the Columns Filter (OPTIONAL)

Defaults to No Filter

0 = Field has no Filter

1 = Field has Filter

		$strFilter = "01110000000000010010";
		

33 Set the Columns Filter to always show or hide (OPTIONAL)

Defaults to false

true = Filter will hide until mouse is over it

false = Filters always shows

		$db_HideFilter = ´true´;
		

34 Set the option for filter to TEXT FIELD or SELECT (OPTIONAL)

Defaults to TEXT

0 = Filter will be a input text box

1 = Filter will be a select box (values for the select option bome from the data in that column

		$strFilterSelect = "01110000000000010010";
		

35 Using a Child Row Template (OPTIONAL)

Using a Child Row Template is optional

It Requires you to create a Template for the display

Add additional CSS to enhance the looks(optional)

		$db_ChildTemplate = "Customers-Child-Template.html";
		

Name this file to match the $db_ChildTemplate path settings

Save this file in the root of the Simple-ConnectDB main folder

Enclose the Field Name in curley brakets {} Note: the Field names must be exactly as in the database

Note: This Template is an only an example however it is used in this demo

Review Bootstrap for more info on how to build the Template with css

	<div class="wrapper">
	<div class="row">
		  <div class="span1">
		  <img class="img-rounded" src="{IMGPhoto}" width="60">
		  </div>
		  <div class="span2">
		  <h5>
		  {ContactFirstName} {ContactLastName}<br>
		  {Address1}<br>
		  {City}, {State} {zip}<br>
		  {Phone}
		  </h5>
		  </div>
		  <div class="span3">
			<dl class="dl-horizontal">
				  <dt>DateEntered</dt><dd>{DateEntered}</dd>
				  <dt>Email</dt><dd>{Email}</dd>
				  <dt>Level</dt><dd>{PriceLevel}</dd>
				  <dt>CreditLimit</dt><dd>{CreditLimit}</dd>
			</dl>
		  </div>
			<div class="span3">
			<dl class="dl-horizontal">
				  <dd>{Memo}</dd>
			</dl>
		  </div>
	</div>
	</div>
		

You can add additional css ti the db_Styles.css located in the assets/css folder

DO NOT alter any of the other css already there, It is needed for the contents of the main application.

you will find /* Child Row CSS */ at the bottom of the db_Styles.css

It already has the class wrapper in it

Note: This Template is only an example, however it is used in the demo

		/* Child Row CSS */
		.wrapper{
			float: left;
			left: 11.00%;
			width: 80%;
			padding:.20%;
			border: 1px solid #336699;
			background-color: #ffffff;
		}
		/* End Child Row CSS */
		

36 Set the Child Row Header (OPTIONAL)

This sets the header text for the child row

Not used with the Child-Tenplate

		$ChildRowHeader = "SHIP TO";
		

37 PopupPlacement (OPTIONAL)

Sets the popup location for the popup when editting

The field must be set to popup for this feature

0 = top

1 = right

2 = bottom

3 = left

		$strPopupPlacement    = "012330000000000000003";
		

38 Textarea number of rows (OPTIONAL)

Sets the the number of rows to show in a textarea field

The default is 5 rows

The [26] is the field numnber

The 7 = seven rows

		$TextareaRows[26] = 7;
		

39 Defines date and comdodate fields (OPTIONAL)

You can have muliple date and combodate fields

DATEPICKER

The date field type in the mySQL database must be set to date

NOTE: Fornat for datepicker and combodate are different

Refer to http://vitalets.github.com/bootstrap-datepicker for the datepicker format options.

ONLY THE SETTINGS LISTED HERE ARE USABLE IN Simple-Connectdb

39-1 Defines the Date Function (*OPTIONAL)

Field-Type must = date

Tell it what field is the Date Field

The [21] says its field number twenty-one(21)

		$DateType[21] = "date";
		

39-2 Date Format (OPTIONAL)

format for when saving the date field

		$DateFormat[21] = "yyyy-mm-dd";
		

39-3 Day of week to start on (OPTIONAL)

Day of week datepicker starts on

0 = Sunday, 6 = Saturday

		$DateWeekStart[21] = 0;
		

39-4 Date Calander starts on (OPTIONAL)

		$DateStartDate[21] = "2013-01-01";
		

39-5 Date Calander ends on (OPTIONAL)

		$DateEndDate[21] = "2015-12-31";
		

39-6 Day Disabled in the calendar (OPTIONAL)

This example disables any date on Sunday and Saturday

		$DateWeekDaysDisabled[21] = "0,6";
		

39-7 Start View of Datepicker (OPTIONAL)

0 = Calendar(default), 1 = Month then calendar and 2 = year then month then calendar

This example would show the year then the month then the complete calendar to select day

		$DateStartView[21] = 2;
		

COMBODATES

Listed are 5 examples for the 5 mySQL date types

The date field in the mySQL database must be set to the correct date type

NOTE: Fornat for datepicker and combodate are different

Refer to http://vitalets.github.com/combodate/#docs for the combodate format options.

ONLY THE SETTINGS LISTED HERE ARE USABLE IN Simple-Connectdb

40-1 combodate date (OPTIONAL)

COMBODATE DATE ONLY
		// COMBODATE DATE ONLY
		$DateType[13] = "combodate";
		$DateFormat[13] = "YYYY-MM-DD";
		$ComboDateTemplate[24] = "YYYY/MMMM/DD";
		$ComboDateMinYear[24] = '2010';
		$ComboDateMaxYear[24] = '2015';
		

39-2 combodate time (OPTIONAL)

COMBODATE TIME ONLY
		// COMBODATE TIME ONLY
		$DateType[22] = "combodate";
		$DateFormat[22] = "HH:mm";
		$ComboDateTemplate[22] = "hh:mm a";
		$ComboTimeMinuteStep[22] = 15;
		

39-3 combodate year (OPTIONAL)

COMBODATE YEAR ONLY
		// COMBODATE YEAR ONLY
		$DateType[23] = "combodate";
		$DateFormat[23] = "YYYY";
		$ComboDateTemplate[23] = "YYYY";
		$ComboDateMinYear[23] = '2010';
		$ComboDateMaxYear[23] = '2015';
		

39-4 combodate datetime (OPTIONAL)

COMBODATE DATETIME
		// COMBODATE DATETIME
		$DateType[24] = "combodate";
		$DateFormat[24] = "YYYY-MM-DD HH:mm";
		$ComboDateTemplate[24] = "YYYY/MMMM/DD hh:mm a";
		$ComboDateMinYear[24] = '2010';
		$ComboDateMaxYear[24] = '2015';
		$ComboTimeMinuteStep[24] = 15;
		

39-5 combodate timestamp(OPTIONAL)

COMBODATE TIMESTAMP
		// COMBODATE TIMESTAMP
		$DateType[25] = "combodate";
		$DateFormat[25] = "YYYY-MM-DD HH:mm";
		$ComboDateTemplate[25] = "YYYY/MMMM/DD hh:mm a";
		$ComboDateMinYear[25] = '2010';
		$ComboDateMaxYear[25] = '2015';
		$ComboTimeMinuteStep[25] = 15;
		
END OF Documentation

Will add more as time goes on

List View

Inline Edit

With Child Row

Add Record

Edit Record

View Record

blue

green

bootstrap

dropbox

dark

ice

black-ice

default

grey

Post all Issues at Simple-ConnectDB

Update and Customize Simple-ConnectDB project with your own features.

Post Updates and your enhancements at Simple-ConnectDB

We will look at them and if all meets the needs. We will add it and show credit to you for a great addon