The next part of this project is the voting system. We will need to create a way for a user to upvote and downvote a book, but also show the calculated score of a book based on votes. To save time, we will set the database to accept a user id for the vote instead of adding a column to the book table for score.
Alternate Code Samples
echo $book['score']; ?: echo '0';
PHP 7: null coalesce operator
echo $book['score']; :: echo '0';
You need to sign up for Treehouse in order to download course files.Sign up