Mercurial > hg > ywww
diff xml/getAmazonInfo.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/xml/getAmazonInfo.php Sun Jan 06 08:09:47 2019 -0500 +++ b/xml/getAmazonInfo.php Sun Jan 06 12:15:42 2019 -0500 @@ -251,8 +251,8 @@ } $queryG = "CALL b_addBrowseNode($key,\"$value\")"; //add the name value pair for genre to new table //echo $queryG; - include "../../private/db.php"; - $resG = mysqli_query($link, $queryG); + include "private/db.php"; + $resG = my_query($queryG,'gai0'); mysqli_close($link); switch ($loop) { @@ -311,22 +311,10 @@ $queryInsert = "CALL b_addNewBook(\"$searchparameterdata\",$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: $queryInsert\n$err\n"); - exit($err); - } + $res = my_query($queryInsert,'gai1'); $queryInsertReviews = "CALL b_insertReviews(\"$searchparameterdata\",\"$review1\",\"$review2\",\"$review3\")"; if($review1 != "") { - $res = mysqli_query($link, $queryInsertReviews); - if (!$res) { - $err=mysqli_error( $link ); - mysqli_close($link); - dl("anr failed: $queryInsertReviews\n"); - exit($err); - } + $res = my_query($queryInsertReviews,'gai2'); } mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop } @@ -345,7 +333,7 @@ include "../../private/db.php"; $query = "CALL b_getBookInfo('$searchparameterdata', $loc)"; //echo $query; - $res = mysqli_query($link, $query) or exit( mysqli_error( $link )); + $res = my_query($query,'gai3'); $output = ""; $output .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";