//Let us know if something is wrong with the connection
if(!$connection){
die('Could not connect: ' . mysql_error());
}
//Puts Session values into variables
$email=$_SESSION['email'];
$password=$_SESSION['password'];
$userId=$_SESSION['userId'];
$username=$_SESSION['username'];
//ensures session credentials have been entered./
if(!isset($_SESSION['email']) || !isset($_SESSION['password'])){
header("Location: ./login.html");
}
//Let us know if something is wrong with the connection
if(!$connection){
die('Could not connect: ' . mysql_error());
}
?>
<?php
mysql_select_db("winelist",$connection);
//select all the wines user has rated
$userRatings="SELECT image,wineName,wineYear,varietal,appearance, aroma, body, taste, finish, ratings, wineId FROM wines
WHERE userId='$userId'";
$userQuery = mysql_query($userRatings);
//display the wines
//Gets us the number of ratings
$numberOfRatings = "SELECT wineName FROM wines WHERE userid='$userId'";
$ratingResult = mysql_query($numberOfRatings);
$totalRatings = mysql_num_rows($ratingResult);
That kind of error almost always means (when it's not just a simple typo) that MySQL was not able to process the query due to some syntax error or an invalid entity name. So check to see if any of the mysql_query() calls are returning false, and if so use mysql_query() to help find out what it's complaining about.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks