Mercurial > hg > ywww
comparison xml/getAmazonInfo.php @ 60:05f29eb72283 default tip
review from DB not working???
| author | Charlie Root |
|---|---|
| date | Sun, 09 Jun 2019 06:50:44 -0400 |
| parents | 5f772caee9a7 |
| children |
comparison
equal
deleted
inserted
replaced
| 59:e4c78b3eace7 | 60:05f29eb72283 |
|---|---|
| 47 $page,$operation,$searchparameter, | 47 $page,$operation,$searchparameter, |
| 48 $searchparameterdata, | 48 $searchparameterdata, |
| 49 $show_array,$show_url,$show_xml); | 49 $show_array,$show_url,$show_xml); |
| 50 } | 50 } |
| 51 catch (Exception $e) { | 51 catch (Exception $e) { |
| 52 dl("gai: falling back to local\n"); | |
| 52 return getAmazonDetLocal($go,$language,$loc, | 53 return getAmazonDetLocal($go,$language,$loc, |
| 53 $page,$operation,$searchparameter, | 54 $page,$operation,$searchparameter, |
| 54 $searchparameterdata, | 55 $searchparameterdata, |
| 55 $show_array,$show_url,$show_xml); | 56 $show_array,$show_url,$show_xml); |
| 56 } | 57 } |
| 82 // that caused an error: | 83 // that caused an error: |
| 83 // If idType equals ASIN, SearchIndex cannot be present | 84 // If idType equals ASIN, SearchIndex cannot be present |
| 84 //'SearchIndex' =>$searchindex , //Books for example. | 85 //'SearchIndex' =>$searchindex , //Books for example. |
| 85 $parameters['SearchIndex']=$searchindex; | 86 $parameters['SearchIndex']=$searchindex; |
| 86 } | 87 } |
| 87 $xml=doAmazonRequest($Aserver[$locale]['ext'],$parameters,3,'i'); // may throw exception | 88 $xml=doAmazonRequest($Aserver[$locale]['ext'],$parameters,2,'i'); // may throw exception |
| 88 set_error_handler(function () { | 89 set_error_handler(function () { |
| 89 global $output; | 90 global $output; |
| 90 dl("Caught one?: $searchparameterdata\n"); | 91 dl("Caught one?: $searchparameterdata\n"); |
| 91 dl(print_r($output, TRUE)."\n"); | 92 dl(print_r($output, TRUE)."\n"); |
| 92 } ); | 93 } ); |
| 331 global $output; | 332 global $output; |
| 332 //look up info from db | 333 //look up info from db |
| 333 include "db.php"; | 334 include "db.php"; |
| 334 $query = "CALL b_getBookInfo('$searchparameterdata', $loc)"; | 335 $query = "CALL b_getBookInfo('$searchparameterdata', $loc)"; |
| 335 //echo $query; | 336 //echo $query; |
| 337 dl("gai: querying $query\n"); | |
| 336 $res = my_query($query,'gai3'); | 338 $res = my_query($query,'gai3'); |
| 337 | 339 |
| 338 $output = ""; | 340 $output = ""; |
| 339 $output .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; | 341 $output .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; |
| 340 $output .= "<Details>"; | 342 $output .= "<Details>"; |
| 352 $output .= "<Publisher>" . htmlspecialchars($rows["Publisher"]) . "</Publisher>"; | 354 $output .= "<Publisher>" . htmlspecialchars($rows["Publisher"]) . "</Publisher>"; |
| 353 $output .= "<Genre1>" . htmlspecialchars($rows["Genre1"]) . "</Genre1>"; | 355 $output .= "<Genre1>" . htmlspecialchars($rows["Genre1"]) . "</Genre1>"; |
| 354 $output .= "<Genre2>" . htmlspecialchars($rows["Genre2"]) . "</Genre2>"; | 356 $output .= "<Genre2>" . htmlspecialchars($rows["Genre2"]) . "</Genre2>"; |
| 355 $output .= "<Genre3>" . htmlspecialchars($rows["Genre3"]) . "</Genre3>"; | 357 $output .= "<Genre3>" . htmlspecialchars($rows["Genre3"]) . "</Genre3>"; |
| 356 $output .= "<ProductGroup>Book</ProductGroup>"; | 358 $output .= "<ProductGroup>Book</ProductGroup>"; |
| 359 if (false) { | |
| 357 $query = "select Review1, Review2, Review3 from b_reviews where ID='$searchparameterdata'"; | 360 $query = "select Review1, Review2, Review3 from b_reviews where ID='$searchparameterdata'"; |
| 358 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop | 361 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop |
| 359 include "db.php"; | 362 include "db.php"; |
| 360 $res = my_query($query,'gai4'); | 363 $res = my_query($query,'gai4'); |
| 361 if ( mysqli_num_rows( $res ) > 0 ) { | 364 if ( mysqli_num_rows( $res ) > 0 ) { |
| 362 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC); | 365 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC); |
| 363 $output .= "<CustomerReviews>"; | 366 $output .= "<CustomerReviews>"; |
| 364 $output .= "<Review>" . htmlspecialchars($rows["Review1"]) . "</Review>"; | 367 $output .= "<Review><Content>" . htmlspecialchars($rows["Review1"]) . "</Content></Review>"; |
| 365 if (isset($rows["Review2"])) { | 368 if (isset($rows["Review2"])) { |
| 366 $output .= "<Review>" . htmlspecialchars($rows["Review2"]) . "</Review>"; | 369 $output .= "<Review><Content>" . htmlspecialchars($rows["Review2"]) . "</Content></Review>"; |
| 367 } | 370 } |
| 368 if (isset($rows["Review3"])) { | 371 if (isset($rows["Review3"])) { |
| 369 $output .= "<Review>" . htmlspecialchars($rows["Review3"]) . "</Review>"; | 372 $output .= "<Review><Content>" . htmlspecialchars($rows["Review3"]) . "</Content></Review>"; |
| 370 } | 373 } |
| 371 $output .= "</CustomerReviews>"; | 374 $output .= "</CustomerReviews>"; |
| 375 } | |
| 376 else { | |
| 377 $output .= "<Error>AccountLimitExceeded</Error>"; | |
| 378 } | |
| 372 } | 379 } |
| 373 else { | 380 else { |
| 374 $output .= "<Error>AccountLimitExceeded</Error>"; | 381 $output .= "<Error>AccountLimitExceeded</Error>"; |
| 375 } | 382 } |
| 376 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop | 383 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop |
