Mercurial > hg > ywww
comparison uk/index.php @ 23:d606320ec331
post-5.7-upgrade efforts to reduce dropped connections, db insertion fails
| author | Charlie Root |
|---|---|
| date | Sun, 30 Dec 2018 07:00:09 -0500 |
| parents | 84a412b8122c |
| children | a67bf725e87b |
comparison
equal
deleted
inserted
replaced
| 22:69c37b58d091 | 23:d606320ec331 |
|---|---|
| 125 $countryCode = 1; | 125 $countryCode = 1; |
| 126 | 126 |
| 127 include "../../private/db.php"; | 127 include "../../private/db.php"; |
| 128 $query = "CALL b_getBookInfo('$isbn', $countryCode)"; | 128 $query = "CALL b_getBookInfo('$isbn', $countryCode)"; |
| 129 //echo $query; | 129 //echo $query; |
| 130 $res = mysqli_query($link, $query) or exit( mysqli_error( $link )); | 130 $res = mysqli_query($link, $query); |
| 131 if (!$res) { | |
| 132 $err=mysqli_error( $link ); | |
| 133 mysqli_close($link); | |
| 134 exit($err); | |
| 135 } | |
| 131 include "../xml/aws_signed_request.php"; | 136 include "../xml/aws_signed_request.php"; |
| 132 include "../xml/getAmazonInfo.php"; | 137 include "../xml/getAmazonInfo.php"; |
| 133 if ( mysqli_num_rows( $res ) > 0 ) | 138 if ( mysqli_num_rows( $res ) > 0 ) |
| 134 { | 139 { |
| 135 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC); | 140 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC); |
| 141 mysqli_close($link); | |
| 136 $title = $rows["Title"]; | 142 $title = $rows["Title"]; |
| 137 $author = $rows["Author"]; | 143 $author = $rows["Author"]; |
| 138 } | 144 } |
| 139 else | 145 else |
| 140 { | 146 { |
| 147 mysqli_close($link); | |
| 141 $bookDetails = getAmazonDet($isbn,1,'uk'); | 148 $bookDetails = getAmazonDet($isbn,1,'uk'); |
| 142 $bookXML = new SimpleXMLElement($bookDetails); | 149 $bookXML = new SimpleXMLElement($bookDetails); |
| 143 if ($bookXML->Items && $bookXML->Items->Item[0] && | 150 if ($bookXML->Items && $bookXML->Items->Item[0] && |
| 144 $bookXML->Items->Item[0]->ItemAttributes) | 151 $bookXML->Items->Item[0]->ItemAttributes) |
| 145 { $attrs=$bookXML->Items->Item[0]->ItemAttributes; | 152 { $attrs=$bookXML->Items->Item[0]->ItemAttributes; |
| 173 //echo $query; | 180 //echo $query; |
| 174 $res = mysqli_query($link, $query) or exit( mysqli_error( $link )); | 181 $res = mysqli_query($link, $query) or exit( mysqli_error( $link )); |
| 175 if ( mysqli_num_rows( $res ) > 0 ) | 182 if ( mysqli_num_rows( $res ) > 0 ) |
| 176 { | 183 { |
| 177 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC); | 184 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC); |
| 185 mysqli_close($link); | |
| 178 $titleL = $rows["Title"]; | 186 $titleL = $rows["Title"]; |
| 179 $authorL = $rows["Author"]; | 187 $authorL = $rows["Author"]; |
| 180 mysqli_close($link); | |
| 181 } | 188 } |
| 182 else | 189 else |
| 183 { | 190 { |
| 191 mysqli_close($link); | |
| 184 $bookLDetails = getAmazonDet($linkedISBN,1,'uk'); | 192 $bookLDetails = getAmazonDet($linkedISBN,1,'uk'); |
| 185 $bookLXML = new SimpleXMLElement($bookLDetails); | 193 $bookLXML = new SimpleXMLElement($bookLDetails); |
| 186 if ($bookLXML->Items && | 194 if ($bookLXML->Items && |
| 187 $bookLXML->Items->Item[0] && | 195 $bookLXML->Items->Item[0] && |
| 188 $bookLXML->Items->Item[0]->ItemAttributes) { | 196 $bookLXML->Items->Item[0]->ItemAttributes) { |
