Appendix A: Using The Sample Code Repository

Each code sample in this book is provided in a GitHub repository at https://github.com/spbooks/phpmysql6. Where a set of code for an example is available in the archive, it is either captioned with its name over the code sample itself (for example PHP-Loops), or I’ll let you know the name of the set of code in the text. You can find the complete sample code on the GitHub repository. In Git’s terminology, each set of code is known as a branch.

There are two ways to use the sample code.

If you just want to view the code for a specific file in a single example, you can do it easily on GitHub. Choose the example by it’s name using the Branch dropdown on the main GitHub page. You will then see a list of files and directories for the selected example (In Git’s terms, this is a Branch) and can click on each file to view the code.

Alternatively, if you would like to easily run the sample code without having to copy and paste files in and out of the web server’s Project directory you can easily do this. I’ve provided a tool that allows you to quickly and easily view any of the code samples.

To use the code samples, follow these steps:

  1. Make sure your Project directory is empty.
  2. Using the git bash tool you use to boot the virtual machine, make sure you have navigated to the directory you normally run vagrant up from then run the following command:

    git clone https://github.com/spbooks/phpmysql6 Project
                    
  3. Visit http://192.168.10.10/samples/, you’ll see a list of all the available samples.

Click on the name of the sample you want to view and the files will be created in the Project directory and view the files on the URL http://192.168.10.10/.

Some Caveats

When You Switch to a Sample, Any Files in the Project Directory Will Be Removed

Once on a specific sample, the Project directory will contain only code for the sample you are viewing. If you had been working on any files they will be hidden. They have not been deleted!

Each time you switch between samples, any changes you have made will be backed up in their own branch based on the branch you made changes to. By default, you will be on the master branch. When you switch to one of the samples, all files you have created in the Project folder will be saved into a branch called master followed by the date at time the snapshot was taken. For example: Master_2017-10-01-17.16.52. You can get your code back by switching to this new branch from the list at http://192.168.10.10/samples/.

Sample Database

All the sample code uses the database ijdb_sample. This database will be deleted and recreated each time you switch between samples, any changes you make to the ijdb_sample database will be lost when you switch between samples. If you are following the book, you should make all your changes to the ijdb database.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.148.124