diff php/read/getBookDetails.php @ 46:b7376319d25a

centralise db query even more
author Charlie Root
date Sun, 06 Jan 2019 12:15:42 -0500
parents 38d209611508
children da133c130c1d
line wrap: on
line diff
--- a/php/read/getBookDetails.php	Sun Jan 06 08:09:47 2019 -0500
+++ b/php/read/getBookDetails.php	Sun Jan 06 12:15:42 2019 -0500
@@ -66,7 +66,7 @@
 	$query = "CALL b_getBookInfo('$isbn', $loc)";
 	//select Timestamp,Title,Author,Binding,DeweyDecimal,ImageURL,SalesRank,PublicationDate,Publisher,Genre1,Genre2,Genre3 from books where ISBN = '$isbn'";
 	//echo $query;
-	$res = mysqli_query($link, $query) or exit( mysqli_error( $link ));
+	$res = my_query($query,'gbd1');
 	
 	if ( mysqli_num_rows( $res ) > 0 )
 	{
@@ -108,7 +108,6 @@
 	  {
 	    include "aws_signed_request.php";
 	    include_once "../../xml/doAmazonRequest.php";
-	    dl("nbd proceeding: $isbn\n");
 
 	    //book does not exist already so look up all the info from browse nodes....
 
@@ -241,7 +240,7 @@
 		  }
 		  $queryG = "CALL b_addBrowseNode($key,\"$value\")";	//add the name value pair for genre to new table	
 		  //echo $queryG;
-		  $resG = mysqli_query($link, $queryG);
+		  $resG = my_query($queryG,'gbd2');
 			
 		  switch ($loop) {
 		  case 1:
@@ -269,13 +268,7 @@
 	      $queryInsert = "CALL b_addNewBook(\"$isbn\",\"$title\", \"$author\",\"$binding\",\"$imageURL\", $dewey, $salesRank,$pubDate,\"$publisher\",$g1,$g2,$g3,$loc)";	
 	      //echo $queryInsert;
 		
-	      $res = mysqli_query($link, $queryInsert);
-	      if (!$res) {
-		$err=mysqli_error( $link );
-		mysqli_close($link);
-		dl("anb failed: $err, $pubDate, $g2, $publisher, $title\n");
-		exit($err);
-	      }
+	      $res = my_query($queryInsert,'gbd3');
 	      mysqli_close($link);	//do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop