Skip to content

Commit 96fb0f7

Browse files
authored
Update README.md
1 parent 6f5d53a commit 96fb0f7

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ There are multiple methods of retrieving data from a MySQL database using PHP. F
1010

1111
## Steps
1212

13-
1. Open up PHPMyAdmin.
13+
1. Open up phpMyAdmin.
1414

15-
If you're using a local server phpMyAdmin can usually be accessed by starting your server and then clickong on the phpMyAdmin link. If you're using a hosting account there will be a link to phpMyAdmin in your control panel.
15+
If you're using a local server phpMyAdmin can usually be accessed by starting your server and then clicking on the phpMyAdmin link. If you're using a hosting account there will be a link to phpMyAdmin in your control panel.
1616

1717
Once you have phpMyAdmin open, click on the import tab and select the `links.sql` file from this repository. This will create a table called `links` and populate it with some sample data.
1818

@@ -35,13 +35,15 @@ if (!$connect)
3535
?>
3636
```
3737

38-
The first line of PHP will initiatie a connection. The `mysqli_connect` function requires a host, username, password, and database name. If you are using a local PHP server link MAMP or WAMP your host is `localhost` and your username and password are likely both `root`. This may vary depending on how you set up your local host. The database name will be whataver you named your database, if you don't have one go ahead an create one.
38+
The first line of PHP will initiatie a connection to your MySQL server. The `mysqli_connect` function requires a host, username, password, and database name.
3939

40-
If you are using a hosting account then your MySQL user and database will need to be created in your hosting control panel. There is likely help in your control panel on what to use for your host.
40+
If you are using a local PHP server link MAMP or WAMP your host is `localhost` and your username and password are likely both `root`. This may vary depending on how you set up your local host. The database name will be whataver you named your database. If you don't have one go ahead an create one.
4141

42-
The second part of teh above code will display an error message if the MySQL connection failed.
42+
If you are using a hosting account, your MySQL user, password, and database will need to be created in your hosting control panel. There is likely help in your control panel on what to use for your host.
4343

44-
> Hint: It would be a good idea to test at thi point, nothing else below will work if your MySQL connection isn't working.
44+
The second part of the above code will display an error message if the MySQL connection fails.
45+
46+
> Hint: It would be a good idea to test at this point, nothing else below will work if your MySQL connection isn't working.
4547
4648
> [More information on PHP and `mysqli_connect()`](https://www.php.net/manual/en/function.mysqli-connect.php)
4749
@@ -66,7 +68,9 @@ echo '<p>The query found ' . mysqli_num_rows($result) . ' rows:</p>';
6668
?>
6769
```
6870

69-
The first block of PHP will create and execute an SQL statement. If this query is successful then inside the `$result` variable will be a list of links. The next block of code will display an error message if the query failed. The final line of PHP will inform us as to how many records teh query retrieved.
71+
The first block of PHP will create and execute an SQL statement. If this query is successful then inside the `$result` variable will be a list of links. The next block of code will display an error message if the query failed. The final line of PHP will inform us as to how many records the query retrieved.
72+
73+
> [More information on PHP and `mysqli_query()`](https://www.php.net/manual/en/mysqli.query.php)
7074
7175
4. After the query has executed successfully, add this PHP:
7276

@@ -91,6 +95,8 @@ while ($record = mysqli_fetch_assoc($result))
9195

9296
The above code will loop through each record and display the link. From here the link information will need to be formatted using HTML just like the [php-for-while](https://github.com/codeadamca/php-for-while) and [php-if-switch](https://github.com/codeadamca/php-if-switch) examples.
9397

98+
> [More information on PHP and `mysqli_fetch_assoc()`](https://www.php.net/manual/en/mysqli-result.fetch-assoc.php)
99+
94100
## Tutorial Requirements:
95101

96102
* [Visual Studio Code](https://code.visualstudio.com/) or [Brackets](http://brackets.io/) (or any code editor)

0 commit comments

Comments
 (0)