Download the example package: php_mysql_csv_example.zip
This package provides a simple, modular intranet database example built with PHP and MySQL, designed for easy modification and learning. It includes CSV export functionality and is based on tutorials I’ve adapted and commented into a compact, practical form. While slightly over-modular, the code is intended as a set of reusable building blocks for your own projects.
The example is intended for local development environments such as MAMP (Mac), WAMP (Windows), or XAMPP (Linux). Make sure you have a MySQL user root
with password root
(commonly preconfigured). Edit the dbinfo.inc.php
file to set database credentials (user
, password
, host
, dbname
, table
), which are referenced throughout the code.
To get started:
-
Open
createdatabase.php
in your browser to create the database and table. -
Then open
index.php
to access the basic interface.
Forms are used to submit data to PHP scripts, which build SQL queries accordingly. Sorting by column headers is also implemented.
Security considerations:
-
Protect sensitive files (like
dbinfo.inc.php
) using.htaccess
and.htpasswd
. -
For public use, implement SQL injection protection — this example is intentionally left open for learning purposes.
Download: php_mysql_csv_example.zip