# HG changeset patch # User Charlie Root # Date 1546794942 18000 # Node ID b7376319d25a24fd46389232eb0c0929310c81a6 # Parent 8bc395c87c6f4ebba1cac60437f0dbe81d3b42a5 centralise db query even more diff -r 8bc395c87c6f -r b7376319d25a php/read/getBookDetails.php --- 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 diff -r 8bc395c87c6f -r b7376319d25a php/read/getLeaderboard.php --- a/php/read/getLeaderboard.php Sun Jan 06 08:09:47 2019 -0500 +++ b/php/read/getLeaderboard.php Sun Jan 06 12:15:42 2019 -0500 @@ -1,9 +1,9 @@ "; diff -r 8bc395c87c6f -r b7376319d25a php/read/getLinkedBooks.php --- a/php/read/getLinkedBooks.php Sun Jan 06 08:09:47 2019 -0500 +++ b/php/read/getLinkedBooks.php Sun Jan 06 12:15:42 2019 -0500 @@ -1,4 +1,5 @@ "; $output .= ""; diff -r 8bc395c87c6f -r b7376319d25a us/index.php --- a/us/index.php Sun Jan 06 08:09:47 2019 -0500 +++ b/us/index.php Sun Jan 06 12:15:42 2019 -0500 @@ -1,6 +1,8 @@ ";