Games"; // We are now ready to print our comments! Below we will loop through our // comments and print them one by one. // The while statement will begin the "looping" /*NOTE that in PHP 7.0, the mysql_fetch_array has been removed -it was previously deprecated in earlier versions of PHP. You find the cod documentation here: https://php.net/manual/en/function.mysql-fetch-array.php */ while($row = mysql_fetch_array($gamesforsale, MYSQL_ASSOC)) { // As we loop through each comment, the specific comment we're working // with right now is stored in the $row variable. // for example, to print the commenter's name, we would use: // $row['name'] // if we want to print the user's comment, we would use: // $row['comment'] // As this is a beginner tutorial, to make our code easier to read // we will take the values above (from our array) and put them into // individual variables $barcode = $row['Barcode']; $Name = $row['Name']; $Description = $row['Description']; $Platform = $row['Platform']; $BoxCondition = $row['BoxCondition']; $AgeRating = $row['AgeRating']; $Quantity = $row['Quantity']; $barcode = htmlspecialchars($row['Barcode'],ENT_QUOTES); $Name = htmlspecialchars($row['Name'],ENT_QUOTES); $Description = htmlspecialchars($row['Description'],ENT_QUOTES); $Platform = htmlspecialchars($row['Platform'],ENT_QUOTES); $BoxCondition = htmlspecialchars($row['BoxCondition'],ENT_QUOTES); $AgeRating = htmlspecialchars($row['AgeRating'],ENT_QUOTES); $Quantity = htmlspecialchars($row['Quantity'],ENT_QUOTES); // We will now print the comment to the screen echo "
Name: $Name
Barcode: $barcode
Description: $Description
Platform: $Platform
Box Condition: $BoxCondition
Age Rating: $AgeRating
Quantity in Stock: $Quantity
Timestamp: $timestamp
"; } // At this point, we've added the user's comment to the database, and we can // now close our connection to the database: mysql_close($con); ?>