Mercurial > hg > ywww
comparison php/read/getLinkedBooks.php @ 46:b7376319d25a
centralise db query even more
| author | Charlie Root |
|---|---|
| date | Sun, 06 Jan 2019 12:15:42 -0500 |
| parents | 077b0a0a3e6d |
| children | a67bf725e87b |
comparison
equal
deleted
inserted
replaced
| 45:8bc395c87c6f | 46:b7376319d25a |
|---|---|
| 1 <?PHP | 1 <?PHP |
| 2 | |
| 2 if(!isset($ret)) | 3 if(!isset($ret)) |
| 3 { | 4 { |
| 4 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); | 5 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
| 5 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); | 6 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
| 6 header("Cache-Control: no-store, no-cache, must-revalidate"); | 7 header("Cache-Control: no-store, no-cache, must-revalidate"); |
| 7 header("Cache-Control: post-check=0, pre-check=0", false); | 8 header("Cache-Control: post-check=0, pre-check=0", false); |
| 8 header("Pragma: no-cache"); | 9 header("Pragma: no-cache"); |
| 9 } | 10 } |
| 11 | |
| 10 $linkedBooks = 0; | 12 $linkedBooks = 0; |
| 11 include "similar.php"; | 13 include "similar.php"; |
| 12 | 14 |
| 13 //$isbn = $_GET['isbn']; | 15 //$isbn = $_GET['isbn']; |
| 14 | 16 |
| 21 } | 23 } |
| 22 else{ | 24 else{ |
| 23 $loc = 1; //default location is 1 | 25 $loc = 1; //default location is 1 |
| 24 } | 26 } |
| 25 | 27 |
| 28 include "private/db.php"; | |
| 29 | |
| 26 if(isset($ret)) | 30 if(isset($ret)) |
| 27 { | 31 { |
| 28 include "../../private/db.php"; | |
| 29 $loc = $countryCode; //passed from index.php when googlebot is crawling | 32 $loc = $countryCode; //passed from index.php when googlebot is crawling |
| 30 } | 33 } |
| 31 else | 34 else |
| 32 { | 35 { |
| 33 include "../../../private/db.php"; | |
| 34 $ret = 0; | 36 $ret = 0; |
| 35 } | 37 } |
| 36 | 38 |
| 37 $query = "CALL b_getLinksForISBN('$isbn',$loc)"; | 39 $query = "CALL b_getLinksForISBN('$isbn',$loc)"; |
| 38 //echo $query; | 40 //echo $query; |
| 39 $results = mysqli_query($link, $query) or exit( mysqli_error( $link )); | 41 $results = my_query($query,'glb'); |
| 40 | 42 |
| 41 $output = "<?xml version=\"1.0\"?>"; | 43 $output = "<?xml version=\"1.0\"?>"; |
| 42 $output .= "<results>"; | 44 $output .= "<results>"; |
| 43 | 45 |
| 44 while($line = mysqli_fetch_assoc($results)) { | 46 while($line = mysqli_fetch_assoc($results)) { |
