Skip to content

PHP Web Development with MySQL Eratta

Chapter 6

  • Page 46, remove example of array_push() for associative arrays and just use +=.

Chapter 9

All references to the northwind database need to be updated

  • Page 79, Listing 9.4, Line 4, missing $ in front of loop iterator variable.

Is:

1
for ($i = 1; $i <= 9; i++ )

Should be:

1
for ($i = 1; $i <= 9; $i++ )

Chapter 12

  • Page 100, broken links

Is: https://raw.githubusercontent.com/jpwhite3/northwind-MySQL/master/northwind.sql and https://raw.githubusercontent.com/jpwhite3/northwind-MySQL/master/northwind-data.sql

Should be: https://raw.githubusercontent.com/dalers/mywind/master/northwind.sql and https://raw.githubusercontent.com/dalers/mywind/master/northwind-data.sql

  • Page 111, Listing 12.2, Line 30

Is:

1
2
$result = mysqli_query($dbc, $query;
        or trigger_error('Error querying database.', E_USER_WARNING);

Should be:

1
2
$result = mysqli_query($dbc, $query)
        or trigger_error('Error querying database.', E_USER_WARNING);

Chapter 19

  • Page 232, 1st paragraph in section Complete Movie Image File Script

The definition of the function removeMovieImageFile() is missing even though it is referenced throughout the book. Since this is a simple function, modify the following paragraph:

From: Our completed movieimagefileutil.php script including our validateMovieImageFile() and addMovieImageFileReturnPathLocation() functions looks like Listing 19.8.

To:

Our completed movieimagefileutil.php script including our validateMovieImageFile(), addMovieImageFileReturnPathLocation(), and added convenience function removeMovieImageFile() functions looks like Listing 19.8.

  • Page 233, Listing 19.8 after Line 90

Add the following to the end of listing:

1
2
3
4
5
6
7
/**
 * @param $movie_file_path
 */
function removeMovieImageFile($movie_file_path)
{
    @unlink($movie_file_path);
}
  • Page 240, Listing 19.14, Lines 76-77:

in_array() in this section of code is a cut-and-paste error from the editmovie.php script.

Is:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<input class="form-check-input" type="checkbox" id="movie_genre_checkbox_action_<?= $genre ?>"  name="movie_genre_checkbox[]"
    value="<?= $genre ?>"<?= in_array($genre, $checked_movie_genres) ?
    'checked' : '' ?>>
~~~~

Should be:
~~~php
<input class="form-check-input" type="checkbox" id="movie_genre_checkbox_action_<?= $genre ?>"  name="movie_genre_checkbox[]"
    value="<?= $genre ?>">
~~~~

- Page 246, Listing 19.17, Line 203:

`in_array()` in this section of code is a cut-and-paste error from the `editmovie.php` script.

Is:
~~~php
<input class="form-check-input" type="checkbox" id="movie_genre_checkbox_action_<?= $genre ?>"  name="movie_genre_checkbox[]"
    value="<?= $genre ?>"<?= in_array($genre, $checked_movie_genres) ? 'checked' : '' ?>>
~~~~

Should be:
~~~php
<input class="form-check-input" type="checkbox" id="movie_genre_checkbox_action_<?= $genre ?>"  name="movie_genre_checkbox[]"
    value="<?= $genre ?>">
~~~~

## Chapter 20

Exercise #3 is a duplication of #2 and should be deleted

## Chapter 21

- Page 289, Listing 21.2, Line 8

Is:
~~~php
<input type="test" class="from-control" id="entered_name"
        name="entered_name" placeholder="Enter your name" required>

Should be:

1
2
<input type="text" class="from-control" id="entered_name"
        name="entered_name" placeholder="Enter your name" required>
  • Page 297, Listing 21.7, Line 26

Is:

1
2
3
4
<input type="test" class="form-control"
        id="entered_cookie" name="entered_cookie"
        placeholder="Enter a cookie you like to eat"
        required>

Should be:

1
2
3
4
<input type="text" class="form-control"
        id="entered_cookie" name="entered_cookie"
        placeholder="Enter a cookie you like to eat"
        required>

Chapter 24

  • Page 374, Last sentance in 'Only Show the Edit Link to Administrators' paragraph

Is: ...below the table starting after the right after the second closing </div> tag.

Should be: ... below the table starting right after the second closing </div> tag.

Chapter 26

  • Page 454, first sentance in last paragraph before aside, should be i.e. and missing closing paren

Is: ...property (e.g., “camel case” style.

Should be: ...property (i.e., “camel case” style).

  • Page 473, [9] link is dead