-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetRatingData.php
More file actions
44 lines (40 loc) · 1.61 KB
/
Copy pathgetRatingData.php
File metadata and controls
44 lines (40 loc) · 1.61 KB
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
40
41
42
43
44
<?php
session_start();
require_once "function.php";
// Here the user id is harcoded.
// You can integrate your authentication code here to get the logged in user id
$userId = 1;
$sid=$_SESSION["stdid"];
$conn = mysqli_connect("localhost", "root", '', "library") or die("Connection failed: " . mysqli_connect_error());
if (mysqli_connect_errno()){
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT ISBNNumber,ReturnDate FROM tblissuedbookdetails where StudentID = '".$sid."';";
$result = mysqli_query($conn,$query);
$outputString = '';
foreach($result as $row)
{
if($row['ReturnDate']==""){
$userRating = userRating($sid, $row['ISBNNumber'], $conn);
$totalRating = totalRating($row['ISBNNumber'], $conn);
$ISBNNumber = "'".$row['ISBNNumber']."'";
$outputString .= '
<ul class="list-inline" onMouseLeave="mouseOutRating(' .$ISBNNumber.','.$userRating.');"> ';
for ($count = 1; $count <= 5; $count ++) {
$starRatingId = $ISBNNumber . '_' . $count;
if ($count <= $userRating) {
$outputString .= '<li value="' . $count . '" ISBN="' . $starRatingId . '" class="star selected">★</li>';
} else {
$outputString .= '<li value="' . $count . '" ISBN="' . $starRatingId . '" class="star" onclick="addRating(' . $ISBNNumber . ',' . $count . ');" onMouseOver="mouseOverRating(' . $ISBNNumber . ',' . $count . ');">★</li>';
}
}
$outputString .= '
</ul>
<p class="review-note">Total Reviews: ' . $totalRating.'</p>
</div>
';
}
}
echo $outputString;
?>