changeset 60:05f29eb72283 default tip

review from DB not working???
author Charlie Root
date Sun, 09 Jun 2019 06:50:44 -0400
parents e4c78b3eace7
children
files xml/getAmazonInfo.php
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/xml/getAmazonInfo.php	Sun Jun 09 06:49:35 2019 -0400
+++ b/xml/getAmazonInfo.php	Sun Jun 09 06:50:44 2019 -0400
@@ -49,6 +49,7 @@
 			      $show_array,$show_url,$show_xml);
   }
   catch (Exception $e) {
+    dl("gai: falling back to local\n");
     return getAmazonDetLocal($go,$language,$loc,
 			     $page,$operation,$searchparameter,
 			     $searchparameterdata,
@@ -84,7 +85,7 @@
     //'SearchIndex'     =>$searchindex      ,  //Books for example.
     $parameters['SearchIndex']=$searchindex;
   }
-  $xml=doAmazonRequest($Aserver[$locale]['ext'],$parameters,3,'i');  // may throw exception
+  $xml=doAmazonRequest($Aserver[$locale]['ext'],$parameters,2,'i');  // may throw exception
   set_error_handler(function () {
       global $output;
       dl("Caught one?: $searchparameterdata\n");
@@ -333,6 +334,7 @@
   include "db.php"; 
   $query = "CALL b_getBookInfo('$searchparameterdata', $loc)";
   //echo $query;
+  dl("gai: querying $query\n");
   $res = my_query($query,'gai3');
 	
   $output = "";
@@ -354,6 +356,7 @@
       $output .=  "<Genre2>" . htmlspecialchars($rows["Genre2"]) . "</Genre2>";
       $output .=  "<Genre3>" . htmlspecialchars($rows["Genre3"]) . "</Genre3>";
       $output .=  "<ProductGroup>Book</ProductGroup>";
+      if (false) {
       $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";
@@ -361,18 +364,22 @@
       if ( mysqli_num_rows( $res ) > 0 ) {
 	$rows=mysqli_fetch_array($res, MYSQLI_ASSOC);
 	$output .=  "<CustomerReviews>";
-	$output .=  "<Review>" . htmlspecialchars($rows["Review1"]) . "</Review>";			
+	$output .=  "<Review><Content>" . htmlspecialchars($rows["Review1"]) . "</Content></Review>";			
         if (isset($rows["Review2"])) {
-	  $output .=  "<Review>" . htmlspecialchars($rows["Review2"]) . "</Review>";			
+	  $output .=  "<Review><Content>" . htmlspecialchars($rows["Review2"]) . "</Content></Review>";			
 	}
         if (isset($rows["Review3"])) {
-	  $output .=  "<Review>" . htmlspecialchars($rows["Review3"]) . "</Review>";			
+	  $output .=  "<Review><Content>" . htmlspecialchars($rows["Review3"]) . "</Content></Review>";			
 	}
 	$output .=  "</CustomerReviews>";
       }
       else {
 	$output .=  "<Error>AccountLimitExceeded</Error>";
       }
+      }
+      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 {