[studentbooks09] r145 committed - updated course selection to sort by course number. Updated detail page...

2 views
Skip to first unread message

student...@googlecode.com

unread,
Dec 12, 2010, 9:53:52 PM12/12/10
to student...@googlegroups.com
Revision: 145
Author: mrjoedowns
Date: Sun Dec 12 18:53:01 2010
Log: updated course selection to sort by course number. Updated detail page
so that it does not show any review display if there are no reviews, just
says there are no reviews for the book
http://code.google.com/p/studentbooks09/source/detail?r=145

Modified:
/trunk/Geekzbookshelf2/center/bookItem.php
/trunk/Geekzbookshelf2/data/dbRetrieval.php
/trunk/Geekzbookshelf2/navigate/return.php

=======================================
--- /trunk/Geekzbookshelf2/center/bookItem.php Fri Dec 10 18:39:33 2010
+++ /trunk/Geekzbookshelf2/center/bookItem.php Sun Dec 12 18:53:01 2010
@@ -81,76 +81,69 @@
<link rel="stylesheet" type="text/css" href="StyleSheets/review.css" />
<?php
///////// Star rating here for statistics
+$line = mysql_fetch_assoc(getStatisticsforBook_Totalreview($bookID));
+if ($line['TotalReview'] >= 1){
echo " <div id='Stattitle' style=' width: 300px' title='Statistics
of ratings' >";
- echo "<div id='reviewtitle' >&nbspTotal reviews: &nbsp &nbsp ";
- $line = mysql_fetch_assoc(getStatisticsforBook_Totalreview($bookID));
if ($line['TotalReview'] >= 1) {echo $line['TotalReview'];} else {
echo "0";}
- echo "</div>";
-
-
- echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_five'></div>&nbsp&nbsp: ";
- $line =
mysql_fetch_assoc(getStatisticsforBookWith_FiveStar($bookID));
- if ($line['Rating'] >= 1) {echo "By (".$line['Rating'].")
People";}
- else { echo "By (0) People"; }
-
-
- echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_four'></div>&nbsp&nbsp: ";
- $line =
mysql_fetch_assoc(getStatisticsforBookWith_FourStar($bookID));
- if ($line['Rating'] >= 1) {echo "By (".$line['Rating'].")
People";}
- else { echo "By (0) People"; }
-
- echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_three'></div>&nbsp&nbsp: ";
- $line =
mysql_fetch_assoc(getStatisticsforBookWith_ThreeStar($bookID));
- if ($line['Rating'] >= 1) {echo "By (".$line['Rating'].")
People";}
- else { echo "By (0) People"; }
-
- echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_two'></div>&nbsp&nbsp: ";
- $line =
mysql_fetch_assoc(getStatisticsforBookWith_TwoStar($bookID));
- if ($line['Rating'] >= 1) {echo "By (".$line['Rating'].")
People";}
- else { echo "By (0) People"; }
-
- echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_one'></div>&nbsp&nbsp: ";
- $line =
mysql_fetch_assoc(getStatisticsforBookWith_OneStar($bookID));
- if ($line['Rating'] >= 1) {echo "By (".$line['Rating'].")
People";}
- else { echo "By (0) People"; }
-
- echo "</br></div></br><hr><b>Other reviews:<b><hr>";
-
- $results = getReviewofaBOOK($bookID);
-
- if(mysql_num_rows($results) > 0)
- {
-
- while ($line = mysql_fetch_assoc($results))
- {
- echo "<div id='review' style=' '><b>By - ".
$line['UserID_Guest']."</b>&nbsp&nbsp" ;
-
- if ($line['Rating'] == 5 )
- {
- echo "<div id='stars' class='s_five'></div>";
- }
- else if ($line['Rating'] == 4 )
- {
- echo "<div id='stars' class='s_four'></div>";
- }
- else if ($line['Rating'] == 3 )
- {
- echo "<div id='stars' class='s_three'></div>";
- }
- else if ($line['Rating'] == 2 )
- {
- echo "<div id='stars' class='s_two'></div>";
- }
- else if($line['Rating'] == 1 )
- {
- echo "<div id='stars' class='s_one'></div>";
- }
- echo "</br>" .$line['Review']. "</br><hr></div>" ;
- }
- }
- else {
- echo "No reviews for this book";
- }
-
+ echo "<div id='reviewtitle' >&nbsp Total
reviews: ".$line['TotalReview']."&nbsp &nbsp ";
+ if ($line['TotalReview'] >= 1)
+ echo "</div>";
+
+
+ echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_five'></div>&nbsp&nbsp: ";
+ $line = mysql_fetch_assoc(getStatisticsforBookWith_FiveStar($bookID));
+ if ($line['Rating'] >= 1) {echo "By (".$line['Rating'].") People";}
+ else { echo "By (0) People"; }
+
+
+ echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_four'></div>&nbsp&nbsp: ";
+ $line = mysql_fetch_assoc(getStatisticsforBookWith_FourStar($bookID));
+ if ($line['Rating'] >= 1) {echo "By (".$line['Rating'].") People";}
+ else { echo "By (0) People"; }
+
+ echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_three'></div>&nbsp&nbsp: ";
+ $line = mysql_fetch_assoc(getStatisticsforBookWith_ThreeStar($bookID));
+ if ($line['Rating'] >= 1) {echo "By (".$line['Rating'].") People";}
+ else { echo "By (0) People"; }
+
+ echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_two'></div>&nbsp&nbsp: ";
+ $line = mysql_fetch_assoc(getStatisticsforBookWith_TwoStar($bookID));
+ if ($line['Rating'] >= 1) {echo "By (".$line['Rating'].") People";}
+ else { echo "By (0) People"; }
+
+ echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_one'></div>&nbsp&nbsp: ";
+ $line = mysql_fetch_assoc(getStatisticsforBookWith_OneStar($bookID));
+ if ($line['Rating'] >= 1) {echo "By (".$line['Rating'].") People";}
+ else { echo "By (0) People"; }
+
+ echo "</br></div></br><hr><b>Other reviews:<b><hr>";
+
+ $results = getReviewofaBOOK($bookID);
+
+ if(mysql_num_rows($results) > 0)
+ {
+
+ while ($line = mysql_fetch_assoc($results)){
+ echo "<div id='review' style=' '><b>By - ".
$line['UserID_Guest']."</b>&nbsp&nbsp" ;
+ if ($line['Rating'] == 5 ){
+ echo "<div id='stars' class='s_five'></div>";
+ }else if ($line['Rating'] == 4 ){
+ echo "<div id='stars' class='s_four'></div>";
+ }else if ($line['Rating'] == 3 ){
+ echo "<div id='stars' class='s_three'></div>";
+ }else if ($line['Rating'] == 2 ){
+ echo "<div id='stars' class='s_two'></div>";
+ }else if($line['Rating'] == 1 ){
+ echo "<div id='stars' class='s_one'></div>";
+ }
+ echo "</br>" .$line['Review']. "</br><hr></div>" ;
+ }
+ }
+ else {
+ echo "No reviews for this book";
+ }
+}else {
+ echo "No reviews for this book";
+}
///


=======================================
--- /trunk/Geekzbookshelf2/data/dbRetrieval.php Sat Dec 11 04:42:22 2010
+++ /trunk/Geekzbookshelf2/data/dbRetrieval.php Sun Dec 12 18:53:01 2010
@@ -10,13 +10,16 @@
//$dbhost = "127.0.0.1";
$dbuser = "booksnine";
$dbpass = "sfulda09";
+ /*$dbhost = "localhost";
+ $dbuser = "root";
+ $dbpass = "";*/
mysql_connect($dbhost, $dbuser, $dbpass); // Connection to MySQL
mysql_select_db($dbname); // Select database
}

function getCourses($school){
openmydb();
- $result = mysql_query("SELECT * FROM courses WHERE school
= '$school'");
+ $result = mysql_query("SELECT * FROM courses WHERE school = '$school'
ORDER BY courseNumber");
//if($result == NULL){echo "RESULT is null";}
return $result;
}
=======================================
--- /trunk/Geekzbookshelf2/navigate/return.php Fri Dec 10 21:16:17 2010
+++ /trunk/Geekzbookshelf2/navigate/return.php Sun Dec 12 18:53:01 2010
@@ -73,59 +73,62 @@
<link rel="stylesheet" type="text/css" href="StyleSheets/review.css" />
<?php
////
+$line = mysql_fetch_assoc(getStatisticsforBook_Totalreview($bookID));
+if ($line['TotalReview'] >= 1){
echo " <div id='Stattitle' style=' width: 300px' title='Statistics
of ratings' ><b>&nbsp Statistics</b></br>";
- echo "<div id='reviewtitle' >&nbsp Total reviews: &nbsp
&nbsp ";
- $line = mysql_fetch_assoc(getStatisticsforBook_Totalreview($bookID));
if ($line['TotalReview'] >= 1) {echo $line['TotalReview'];} else {
echo "0";}
- echo "</div>";
-
- echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_five'></div>&nbsp&nbsp: ";
- $line =
mysql_fetch_assoc(getStatisticsforBookWith_FiveStar($bookID));
- if ($line['Rating'] >= 1) {echo $line['Rating'];}
- else { echo "0"; }
-
-///// Star rating here for statistics
- echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_four'></div>&nbsp&nbsp: ";
- $line =
mysql_fetch_assoc(getStatisticsforBookWith_FourStar($bookID));
- if ($line['Rating'] >= 1) {echo $line['Rating'];}
- else { echo "0"; }
-
- echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_three'></div>&nbsp&nbsp: ";
- $line =
mysql_fetch_assoc(getStatisticsforBookWith_ThreeStar($bookID));
- if ($line['Rating'] >= 1) {echo $line['Rating'];}
- else { echo "0"; }
-
- echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_two'></div>&nbsp&nbsp: ";
- $line =
mysql_fetch_assoc(getStatisticsforBookWith_TwoStar($bookID));
- if ($line['Rating'] >= 1) {echo $line['Rating'];}
- else { echo "0"; }
-
- echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_one'></div>&nbsp&nbsp: ";
- $line =
mysql_fetch_assoc(getStatisticsforBookWith_OneStar($bookID));
- if ($line['Rating'] >= 1) {echo $line['Rating'];}
- else { echo "0"; }
-
- echo "</br></div></br>";
-
- $results = getReviewofaBOOK($bookID);
-
- if(mysql_num_rows($results) > 0){
- while ($line = mysql_fetch_assoc($results)){
- echo "<div id='review' style=' '><b>By - ".
$line['UserID_Guest']."</b>&nbsp&nbsp" ;
- if ($line['Rating'] == 5 ){
- echo "<div id='stars' class='s_five'></div>";
- }else if ($line['Rating'] == 4 ){
- echo "<div id='stars' class='s_four'></div>";
- }else if ($line['Rating'] == 3 ){
- echo "<div id='stars' class='s_three'></div>";
- }else if ($line['Rating'] == 2 ){
- echo "<div id='stars' class='s_two'></div>";
- }else if($line['Rating'] == 1 ){
- echo "<div id='stars' class='s_one'></div>";
-
}echo "</br>" .$line['Review']. "</br><hr></div>" ;}
- }
- else {
- echo "No reviews for this book";
- }
+ echo "<div id='reviewtitle' >&nbsp Total reviews: &nbsp &nbsp ";
+ $line = mysql_fetch_assoc(getStatisticsforBook_Totalreview($bookID));
if ($line['TotalReview'] >= 1) {echo $line['TotalReview'];} else {
echo "0";}
+ echo "</div>";
+
+ echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_five'></div>&nbsp&nbsp: ";
+ $line = mysql_fetch_assoc(getStatisticsforBookWith_FiveStar($bookID));
+ if ($line['Rating'] >= 1) {echo $line['Rating'];}
+ else { echo "0"; }
+
+ ///// Star rating here for statistics
+ echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_four'></div>&nbsp&nbsp: ";
+ $line = mysql_fetch_assoc(getStatisticsforBookWith_FourStar($bookID));
+ if ($line['Rating'] >= 1) {echo $line['Rating'];}
+ else { echo "0"; }
+
+ echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_three'></div>&nbsp&nbsp: ";
+ $line = mysql_fetch_assoc(getStatisticsforBookWith_ThreeStar($bookID));
+ if ($line['Rating'] >= 1) {echo $line['Rating'];}
+ else { echo "0"; }
+
+ echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_two'></div>&nbsp&nbsp: ";
+ $line = mysql_fetch_assoc(getStatisticsforBookWith_TwoStar($bookID));
+ if ($line['Rating'] >= 1) {echo $line['Rating'];}
+ else { echo "0"; }
+
+ echo " </br>&nbsp&nbsp&nbsp<div id='stars'
class='s_one'></div>&nbsp&nbsp: ";
+ $line = mysql_fetch_assoc(getStatisticsforBookWith_OneStar($bookID));
+ if ($line['Rating'] >= 1) {echo $line['Rating'];}
+ else { echo "0"; }
+
+ echo "</br></div></br>";
+
+ $results = getReviewofaBOOK($bookID);
+
+ if(mysql_num_rows($results) > 0){
+ while ($line = mysql_fetch_assoc($results)){
+ echo "<div id='review' style=' '><b>By - ".
$line['UserID_Guest']."</b>&nbsp&nbsp" ;
+ if ($line['Rating'] == 5 ){
+ echo "<div id='stars' class='s_five'></div>";
+ }else if ($line['Rating'] == 4 ){
+ echo "<div id='stars' class='s_four'></div>";
+ }else if ($line['Rating'] == 3 ){
+ echo "<div id='stars' class='s_three'></div>";
+ }else if ($line['Rating'] == 2 ){
+ echo "<div id='stars' class='s_two'></div>";
+ }else if($line['Rating'] == 1 ){
+ echo "<div id='stars' class='s_one'></div>";
+ }echo "</br>" .$line['Review']. "</br><hr></div>" ;}
+ }
+}else{
+ echo "No reviews for this book";
+}
+
echo "</div>";
echo "</div>";
closemydb();

Reply all
Reply to author
Forward
0 new messages