changeset 56:5f772caee9a7

try getting review from DB if throttled
author Charlie Root
date Fri, 07 Jun 2019 16:36:06 -0400
parents 72708ec9c0e6
children 7f90ac957713
files xml/getAmazonInfo.php
diffstat 1 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/xml/getAmazonInfo.php	Fri Jun 07 16:35:35 2019 -0400
+++ b/xml/getAmazonInfo.php	Fri Jun 07 16:36:06 2019 -0400
@@ -341,7 +341,6 @@
   if ( mysqli_num_rows( $res ) > 0 )
     {
       $rows=mysqli_fetch_array($res, MYSQLI_ASSOC);
-      mysqli_close($link);	//do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop						
       $output .=  "<ASIN>" . $searchparameterdata . "</ASIN>";
       $output .=  "<Title>" . htmlspecialchars($rows["Title"]) . "</Title>";			
       $output .=  "<Author>" . htmlspecialchars($rows["Author"]) . "</Author>";
@@ -355,10 +354,29 @@
       $output .=  "<Genre2>" . htmlspecialchars($rows["Genre2"]) . "</Genre2>";
       $output .=  "<Genre3>" . htmlspecialchars($rows["Genre3"]) . "</Genre3>";
       $output .=  "<ProductGroup>Book</ProductGroup>";
-      $output .=  "<Error>AccountLimitExceeded</Error>";
-			
+      $query = "select Review1, Review2, Review3 from b_reviews where ID='$searchparameterdata'";
+      mysqli_close($link);	//do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop
+      include "db.php";
+      $res = my_query($query,'gai4');
+      if ( mysqli_num_rows( $res ) > 0 ) {
+	$rows=mysqli_fetch_array($res, MYSQLI_ASSOC);
+	$output .=  "<CustomerReviews>";
+	$output .=  "<Review>" . htmlspecialchars($rows["Review1"]) . "</Review>";			
+        if (isset($rows["Review2"])) {
+	  $output .=  "<Review>" . htmlspecialchars($rows["Review2"]) . "</Review>";			
+	}
+        if (isset($rows["Review3"])) {
+	  $output .=  "<Review>" . htmlspecialchars($rows["Review3"]) . "</Review>";			
+	}
+	$output .=  "</CustomerReviews>";
+      }
+      else {
+	$output .=  "<Error>AccountLimitExceeded</Error>";
+      }
+      mysqli_close($link);	//do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop						
     }
   else {
+    $output .=  "<Error>AccountLimitExceeded</Error>";
     mysqli_close($link);	//do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop
   }
   $output .=  "</Details>";