GridIron
Using GridIron with a MySQL Database
Using GridIron with a MySQL Database
GridIron supports MySQL databases as a live data source. This is a powerful option for users with dynamic or frequently updated datasets, enabling them to display data-driven tables, lists, or grids without having to update CSV or spreadsheet files manually.
What You’ll Need
A web server with access to MySQL or MariaDB (most commonly via cPanel)
Credentials for:
- Database name
- Database username
- Database password
- Table name containing your data
GridIron installed in RapidWeaver, RapidWeaver Classic, or the Stacks App
GridIron does not require advanced SQL knowledge. Once the database and table are ready, it takes care of the rest.
Step 1: Set Up Your MySQL Database
If you don’t already have a MySQL database available, follow these steps using your web hosting control panel (typically cPanel):
- Log into cPanel
- Navigate to MySQL® Databases
Create a Database
- Under "Create New Database", enter a name (e.g.
gridirondata
) - Click Create Database
Create a User
- Scroll to "MySQL Users"
- Add a new user (e.g.
gridironuser
) with a secure password
Add User to Database
- Scroll to "Add User to Database"
- Select the user and database created above
- Click Add
- Grant the user All Privileges
Step 2: Create a Table with Data
You can do this using phpMyAdmin, usually accessible from cPanel.
- Go to phpMyAdmin
- Select your new database from the sidebar
- Click Create Table (e.g. name it
puppytraining
) - Define your columns, for example:
Column Name | Type | Notes |
---|---|---|
id | INT | Auto Increment, PK |
command | VARCHAR(50) | E.g. “Sit” |
description | TEXT | E.g. “Dog sits down” |
- Add a few rows of test data
Step 3: Add GridIron and Connect to MySQL
- In your RapidWeaver or Stacks App project, drag in a GridIron stack
- Click the blue
+
button and choose a layout (e.g. Simple Table) - In the main GridIron stack settings, set the Data Source Type to:
MySQL
Now fill in the database settings:
Field | What to Enter |
---|---|
Host | Usually localhost , or your host's DB server |
Database Name | Your DB name (e.g. griddemo ) |
Username | DB user name (e.g. griduser ) |
Password | The password for the DB user |
Table Name | The name of your table (e.g. dogcommands ) |
⚠️ The database must be on the same server as your site, or remotely accessible (some hosts block external connections). If unsure, please check with your hosting company.
Step 4: Preview the Result
When you preview the page, GridIron will connect to your MySQL table and display its contents using the selected layout.
If it fails, check:
- Username/password
- Table name spelling
- That your hosting provider allows PHP to connect to MySQL (PHP 8.2+ is required)
Performance and Security Notes
- GridIron does not allow arbitrary SQL. It fetches data in a safe, read-only way.
- The credentials you enter are not exposed in the page source.
- GridIron can cache database output to reduce load — see the Cache Duration setting.
Benefits of Using MySQL with GridIron
- Seamless integration with existing web applications or CMSs
- Perfect for dynamic data and large datasets
- No need to upload files
- Fully server-based — no third-party services required
Example Use Cases
- Product inventory from a store database
- Client submissions stored by a form processor
- Schedules or rotas managed via a web app
- Live status feeds (e.g. equipment, bookings, occupancy)
Common Issues
Problem | Solution |
---|---|
"Could not connect to database" | Check host, user, password, and DB name. Try localhost for host. |
Empty table output | Ensure the table has data and columns, and that GridIron can access it. |
Table not found | Double-check table name and capitalisation. |
External DB not connecting | Ensure remote MySQL access is enabled in your hosting panel. |