Mercurial > hg > ywww
view php/read/map/getMapSavedBooks.php @ 43:dbc006408d2b
ASSUMES we have SetEnv PHP_VALUE "include_path =.:/var/test/private:/var/test/ywww:/usr/share/php" in apache2/.../test.conf
use dl(...) for debug logging, defined in dlog.php
use doAmazonRequest in amazonBookSearch
use ../private/web.php (q.v., not in mercurial) for Aserver and Aassociates
Started by updating from 40:c24ae74bf6d5, i.e. just before the bug on the main line
| author | Charlie Root |
|---|---|
| date | Sat, 05 Jan 2019 18:00:10 -0500 |
| parents | 077b0a0a3e6d |
| children | 385ddd7c4b55 a67bf725e87b |
line wrap: on
line source
<?PHP include "../../../../private/db.php"; $savedBooks = 0; $Map = $_GET['Map']; if(isset($_GET['User'])){ $UserID = $_GET['User']; } else{ $UserID = 0; //default user is Bestseller } $query = "CALL b_getMapSavedBooksByUser($UserID,'$Map')"; // $output .= $query; $results = mysqli_query($link, $query) or exit( mysqli_error( $link )); $output = ""; $output .= "<?xml version=\"1.0\"?>"; $output .= "<results>"; $output .= "<UserID>" . htmlspecialchars(trim($UserID)) . "</UserID>"; $prevListName = ""; while($line = mysqli_fetch_assoc($results)) { $listName = htmlspecialchars(trim($line["SavedListName"])); if($listName != $prevListName) { if($savedBooks != 0) { $output .= "</ListDetails>"; $output .= "</List>"; } $output .= "<List>"; $output .= "<SavedListName>" . $listName . "</SavedListName>"; $output .= "<ListDetails>"; $prevListName = $listName; } $output .= "<Book>"; $output .= "<ISBN>" . htmlspecialchars(trim($line["ISBN"])) . "</ISBN>"; $output .= "<PictureURL>" . htmlspecialchars(trim($line["PictureURL"])) . "</PictureURL>"; $output .= "<BookTitle>" . htmlspecialchars(trim($line["BookTitle"])) . "</BookTitle>"; $output .= "<SaveID>" . htmlspecialchars(trim($line["SaveID"])) . "</SaveID>"; $output .= "</Book>"; $savedBooks++; } if($savedBooks != 0) { $output .= "</ListDetails>"; $output .= "</List>"; } $output .= "</results>"; if(isset($ret)) return $output; else echo $output; mysqli_close($link); ?>
