Mercurial > hg > ywww
comparison xml/getAmazonInfo.php @ 56:5f772caee9a7
try getting review from DB if throttled
| author | Charlie Root |
|---|---|
| date | Fri, 07 Jun 2019 16:36:06 -0400 |
| parents | a67bf725e87b |
| children | 05f29eb72283 |
comparison
equal
deleted
inserted
replaced
| 55:72708ec9c0e6 | 56:5f772caee9a7 |
|---|---|
| 339 $output .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; | 339 $output .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; |
| 340 $output .= "<Details>"; | 340 $output .= "<Details>"; |
| 341 if ( mysqli_num_rows( $res ) > 0 ) | 341 if ( mysqli_num_rows( $res ) > 0 ) |
| 342 { | 342 { |
| 343 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC); | 343 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC); |
| 344 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop | |
| 345 $output .= "<ASIN>" . $searchparameterdata . "</ASIN>"; | 344 $output .= "<ASIN>" . $searchparameterdata . "</ASIN>"; |
| 346 $output .= "<Title>" . htmlspecialchars($rows["Title"]) . "</Title>"; | 345 $output .= "<Title>" . htmlspecialchars($rows["Title"]) . "</Title>"; |
| 347 $output .= "<Author>" . htmlspecialchars($rows["Author"]) . "</Author>"; | 346 $output .= "<Author>" . htmlspecialchars($rows["Author"]) . "</Author>"; |
| 348 $output .= "<Binding>" . htmlspecialchars($rows["Binding"]) . "</Binding>"; | 347 $output .= "<Binding>" . htmlspecialchars($rows["Binding"]) . "</Binding>"; |
| 349 $output .= "<Dewey>" . htmlspecialchars($rows["DeweyDecimal"]) . "</Dewey>"; | 348 $output .= "<Dewey>" . htmlspecialchars($rows["DeweyDecimal"]) . "</Dewey>"; |
| 353 $output .= "<Publisher>" . htmlspecialchars($rows["Publisher"]) . "</Publisher>"; | 352 $output .= "<Publisher>" . htmlspecialchars($rows["Publisher"]) . "</Publisher>"; |
| 354 $output .= "<Genre1>" . htmlspecialchars($rows["Genre1"]) . "</Genre1>"; | 353 $output .= "<Genre1>" . htmlspecialchars($rows["Genre1"]) . "</Genre1>"; |
| 355 $output .= "<Genre2>" . htmlspecialchars($rows["Genre2"]) . "</Genre2>"; | 354 $output .= "<Genre2>" . htmlspecialchars($rows["Genre2"]) . "</Genre2>"; |
| 356 $output .= "<Genre3>" . htmlspecialchars($rows["Genre3"]) . "</Genre3>"; | 355 $output .= "<Genre3>" . htmlspecialchars($rows["Genre3"]) . "</Genre3>"; |
| 357 $output .= "<ProductGroup>Book</ProductGroup>"; | 356 $output .= "<ProductGroup>Book</ProductGroup>"; |
| 358 $output .= "<Error>AccountLimitExceeded</Error>"; | 357 $query = "select Review1, Review2, Review3 from b_reviews where ID='$searchparameterdata'"; |
| 359 | 358 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop |
| 359 include "db.php"; | |
| 360 $res = my_query($query,'gai4'); | |
| 361 if ( mysqli_num_rows( $res ) > 0 ) { | |
| 362 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC); | |
| 363 $output .= "<CustomerReviews>"; | |
| 364 $output .= "<Review>" . htmlspecialchars($rows["Review1"]) . "</Review>"; | |
| 365 if (isset($rows["Review2"])) { | |
| 366 $output .= "<Review>" . htmlspecialchars($rows["Review2"]) . "</Review>"; | |
| 367 } | |
| 368 if (isset($rows["Review3"])) { | |
| 369 $output .= "<Review>" . htmlspecialchars($rows["Review3"]) . "</Review>"; | |
| 370 } | |
| 371 $output .= "</CustomerReviews>"; | |
| 372 } | |
| 373 else { | |
| 374 $output .= "<Error>AccountLimitExceeded</Error>"; | |
| 375 } | |
| 376 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop | |
| 360 } | 377 } |
| 361 else { | 378 else { |
| 379 $output .= "<Error>AccountLimitExceeded</Error>"; | |
| 362 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop | 380 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop |
| 363 } | 381 } |
| 364 $output .= "</Details>"; | 382 $output .= "</Details>"; |
| 365 echo $output; | 383 echo $output; |
| 366 } | 384 } |
