Mercurial > hg > ywww
view php/read/map/getMapRecommPaths.php @ 49:a67bf725e87b
put both paths in include_path and depend on that
author | Charlie Root |
---|---|
date | Wed, 16 Jan 2019 13:42:15 -0500 |
parents | 077b0a0a3e6d |
children |
line wrap: on
line source
<?PHP if(!isset($ret)) { header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); } $linkedBooks = 0; $UserID = $_GET['user']; if(isset($_GET['loc'])){ $loc = $_GET['loc']; } else{ $loc = 0; //default location is 1 } if(isset($_GET['listname'])){ $listName = $_GET['listname']; } else{ $listName = "MyMap"; //default map } include "db.php"; //need to have an if statement to catch the first time it is run and call - CALL b_setMapAuthorXYcoord //Can swicth to this call if the map is having problems //Need to CALL b_setMap_RelatedISBNs to create the initial relationships and then //b_setMap_AllRelatedISBNs b_setMap_relatedISBNs b_setMap_updateRelatedDuplicate //Need to CALL b_setMap_updateRelatedDuplicate to update the relationships //$query = "CALL b_getMap_relatedBooksNPath('$UserID', $loc)"; // this generates fixed points - //Need to call this b_setupUserMap if there are no books for that UserID // $query = "CALL b_getMap_relatedBooksNPath($UserID, $loc,\"$listName\")"; $query = "CALL b_getMap_topRelatedBNP($UserID, $loc,\"$listName\")"; $results = mysqli_query($link, $query) or exit( mysqli_error( $link )); if( mysqli_num_rows($results) == 0) { //populate the data mysqli_close($link); include "db.php"; $query1 = "CALL b_setupUserMap($UserID, $loc,\"$listName\")"; $results1 = mysqli_query($link, $query1) or exit( mysqli_error( $link )); mysqli_close($link); include "db.php"; // $query = "CALL b_getMap_relatedBooksNPath($UserID, $loc,\"$listName\")"; $query = "CALL b_getMap_topRelatedBNP($UserID, $loc,\"$listName\")"; $results = mysqli_query($link, $query) or exit( mysqli_error( $link )); } $output = "<?xml version=\"1.0\"?>"; $output .= "<results>"; $LastISBN = "START"; $ChangePaths = 0; while($line = mysqli_fetch_assoc($results)) { $ISBN =trim($line["ISBN"]); $Title =trim($line["Title"]); $Author =trim($line["Author"]); $ImageURL =trim($line["ImageURL"]); $ISBN2 =trim($line["ISBN2"]); IF ($LastISBN != $ISBN && $ChangePaths == 1) { $output .= "</PATHS>"; $output .= "</Node>"; $ChangePaths = 0; } IF ($LastISBN != $ISBN ) { $ChangePaths = 1; $output .= "<Node>"; $output .= "<ISBN>" . $ISBN . "</ISBN>"; $output .= "<Title>" . $Title . "</Title>"; $output .= "<Author>" . $Author . "</Author>"; $output .= "<ImageURL>" . $ImageURL. "</ImageURL>"; $output .= "<PATHS>"; } $output .= "<ISBN2>" . $ISBN2 . "</ISBN2>"; $LastISBN = $ISBN; } $output .= "</PATHS>"; $output .= "</Node>"; $output .= "</results>"; echo $output; mysqli_close($link); ?>