Please enable JavaScript to view this site.

Navigation: Using PHPRunner

PHPrunner32x32     PHPRunner manual


Datasource tables

Scroll Prev Next More

Working with tables

After you successfully connected to the database, select all datasource tables you'd like to build PHP code for. Next, highlight one of the selected tables and proceed through the other screens in PHPRunner adjusting settings for the selected table.

 

You can always see the name of the currently selected table in the middle of the blue info pane on top. To switch between selected tables, use the Table list pane on the left.

intro_modify_tables

 

Type in the name, type, size, scale (applies to the DECIMAL field type in SQL Server, Oracle and MySQL only) for each field. Set the Primary key field. Click Create table.

connectdb_create_msaccess_db

 

Note: you can also add a new custom view, report, chart, or dashboard to your project.

 

To edit or delete the tables, right-click the table name in the list.

step3-3

Toolbar description:

Button

Description

sync_bt

Synchronizes the database.

menu_editor_bt

Opens Menu Builder.

arrange_tables_bt

Arranges tables alphabetically.

show_fields_bt

Shows all fields in all tables.

hide_all_fields_bt

Hides all fields in all tables.

change_caption_bt

Opens the Label Editor where you can change the table captions.

add_relations_bt

Opens the Table link properties window where you can add new table relations.

hide_fields_bt

Shows/Hides fields for the currently selected table.

create_sql_script_bt

Opens the Create SQL script window where you can create SQL scripts for tables/data transfer to another server.

search_bt2

Searches the table names.

 

To open the context menu of a table/view/chart/report/dashboard, click context_menu_bt near its name or right-click the table.

context_menu_table

 

The Change caption option allows editing caption and field labels. Click the Advanced option to change the base table for view/chart/report or filename prefix.

context_menu_adv

 

Since the view, chart, and report may include fields from several tables, the base table is the table where the data is added, edited, and deleted. Key columns can be selected for the base table on the Choose pages screen.

 

By default, the prefix for each generated file name is the table name. E.g., if the table name is OrderDetails, the file name of the List page becomes OrderDetails_list.php. If you change the prefix to details, the file name becomes details_list.php.

Create a custom View

Click Create custom View to create an additional view of the same table. This feature is useful if you want to present several views of the same data.

step3-2

 

When you create a new custom view, all current settings of the table are copied into it, except for visual templates and events. You can create a copy of an existing custom view: right-click the custom view and select Copy.

 

Note: custom views are not created in the database and only exist in the project.

Example:

The Cars table shows all cars in the database. SQL query: select * from Cars.

 

The Active listings view displays only the active listings. SQL Query: select * from Cars where status='active'.

 

The Closed listings view displays only the closed listings. SQL Query: select * from Cars where status='closed'.

 

The SQL query can be modified later on the SQL query screen in PHPRunner.

 

Note: when you create a custom view, all table settings are copied to the Custom view settings.

Synchronize database

Every time you make changes on the Datasource tables screen (e.g., create a new table, add or edit table fields, etc.), make sure that these changes are synchronized with the database. The structures of the database and PHPRunner project should be synchronized.

 

To synchronize the database manually, use the Sync database button or right-click the table tree or blank area near the table tree and select Sync database.

 

Note: you can also use the option to synchronize the database automatically each time the project loads (select Project -> Settings). Use this option for small or local databases. With the remote or large databases, the automatic synchronization takes more time upon opening the project.

See Working with projects to learn more

project_settings

Renamed/deleted tables

The tables that were renamed outside of PHPRunner or deleted in PHPRunner are moved to the Deleted tables folder. You can restore, rename and restore, or remove the selected table from the project permanently.

deleted_tables

 

Right-click the Deleted tables folder to get two options: Remove all tables and Restore all tables.

deleted_tables_options

Multiple database connections

You can add multiple data sources and mix several database types like MS Access, SQL Server, and MySQL in a single PHPRunner project. You can have a master table in MySQL and a details table in MS Access. The same applies to lookup tables.

 

Note: the Multiple database connections feature is available only in the Enterprise Edition of PHPRunner. See Editions Comparison to learn more.

 

To add a new database connection:

 

click Add connection;

select the database type and connect to the database.

add_connection

 

The first database connection is considered "primary". However you can make any other connection primary by right-clicking the database name and selecting the corresponding option.

multiple_connections

 

The following features work only with the primary database connection:

 

Data Access Layer (deprecated; use Database API - it works with multiple database connections);

Add template to project - the template is added only to the primary database;

Upload to demo account - the tables from the primary database are uploaded to the demo account.

 

All other features work with all database connections, including the Save project as template option.

 

We do not advise to add tables with the same names that belong to different databases to avoid conflicts.

See also:

Create a report

Create a chart

Create a dashboard

Master-details relationship between tables

Connecting to the database

SQL query screen

Choose pages screen