You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository contains a simple web application that demonstrates how to quickly connect to and communicate with a [MariaDB](https://mariadb.com) database using [PHP](https://www.php.net/).
4
+
5
+
<palign="center"spacing="10">
6
+
<kbd>
7
+
<img src="media/demo.gif" />
8
+
</kbd>
9
+
</p>
10
+
11
+
## Getting Started
12
+
13
+
The application in this repository demonstrates how to:
14
+
15
+
* Connect to a MariaDB database using [mysqli](https://www.php.net/manual/en/book.mysqli.php)
16
+
* Execute queries (`SELECT`, `UPDATE`, `INSERT` and `DELETE`) to manage _contact_ data (like a digital [rolodex](https://en.wikipedia.org/wiki/Rolodex))
17
+
* Use prepared statements
18
+
19
+
### Prepare the database
20
+
21
+
The application relies on a single database (`rolodex`) that contains a single table (`contacts`). You can find the necessary SQL for setting up the environment in [schema.sql](schema.sql).
22
+
23
+
### Run the application
24
+
25
+
After you've [pulled down this repository](https://git-scm.com/docs/git-clone), follow these steps to get the app up and running:
26
+
27
+
1. Update the database configuration settings in [config.php](src/config.php) (which is used across the app) to point to _your_ MariaDB database.
28
+
29
+
_Example configuration:_
30
+
31
+
```php
32
+
$databaseHost = '127.0.0.1';
33
+
$databaseUsername = 'user_name';
34
+
$databasePassword = '********';
35
+
$databaseName = 'rolodex';
36
+
```
37
+
38
+
**Note:** Check out the [config_skysql.php](config_skysql.php) file for an example of how to connect to [MariaDB SkySQL](https://mariadb.com/skyview).
39
+
40
+
2. Run the application using the [built-in web server](https://www.php.net/manual/en/features.commandline.webserver.php).
echo"<td><a href=\"edit.php?id=$res[id]\">Edit</a> | <a href=\"delete.php?id=$res[id]\" onClick=\"return confirm('Are you sure you want to delete this contact?')\">Delete</a></td>";
0 commit comments