Skip to content

Commit

Permalink
sorts restaurants
Browse files Browse the repository at this point in the history
  • Loading branch information
vroycroft committed Nov 29, 2010
1 parent cb62f2f commit a848954
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion index.php
Expand Up @@ -12,7 +12,7 @@
<b><p><font size="6.5" face="Georgia" color="000066">R</font><font size="4.5" face="Georgia">estaurants currently in the database:</p></b></font>

<?php
$query = "SELECT restaurant_id, name FROM $table";
$query = "SELECT restaurant_id, name FROM $table ORDER BY name";
$result = mysqli_query($db, $query)
or die("Error Querying Database");

Expand Down
15 changes: 8 additions & 7 deletions userProfile.php
Expand Up @@ -338,7 +338,8 @@
}
//echo "numOfClosest: $numOfClosest";

$count = 0;
$restaurantIDs[0] = 0;
$count = 1;

$query = "SELECT * FROM UserRatings WHERE user_id = '$user_id';";
$result = mysqli_query($db, $query)
Expand Down Expand Up @@ -375,7 +376,7 @@


if ($numOfRatings == 0) {
//echo "<h1>No results matched your search!</h1>";
echo "<h1>This user hasn't rating anything yet!</h1>";
} else {
//echo "yay";

Expand All @@ -384,22 +385,22 @@
$rating = $row['rating'];
$restID = $row['restaurant_id'];

for($j=0; $j<$count; ++$j)
{
//for($j=0; $j<$count; ++$j)
//{
//echo "restIDs[j]: $restaurantIDs[$j] <br/>";
//echo "restID: $restID <br/>";
if(!in_array($restID, $restaurantIDs))
{
echo"in 1st if <br/>";
//echo"in 1st if <br/>";
if($rating > $maxRating)
{

echo "in 2nd if <br/>";
//echo "in 2nd if <br/>";
$maxRating = $rating;
//$maxRatings[$i][0] = $maxRating;
//$maxRatings[0][1] = $restID;
}
}
//}
}
}
}
Expand Down

0 comments on commit a848954

Please sign in to comment.