Mercurial > hg > ywww
comparison php/read/map/getMapSavedBooks.php @ 6:077b0a0a3e6d
remaining originals according to dependency walk
| author | Robert Boland <robert@markup.co.uk> |
|---|---|
| date | Thu, 16 Feb 2017 22:29:02 +0000 |
| parents | |
| children | 385ddd7c4b55 a67bf725e87b |
comparison
equal
deleted
inserted
replaced
| 5:55445b456ad0 | 6:077b0a0a3e6d |
|---|---|
| 1 <?PHP | |
| 2 | |
| 3 include "../../../../private/db.php"; | |
| 4 | |
| 5 $savedBooks = 0; | |
| 6 | |
| 7 $Map = $_GET['Map']; | |
| 8 | |
| 9 if(isset($_GET['User'])){ | |
| 10 $UserID = $_GET['User']; | |
| 11 } | |
| 12 else{ | |
| 13 $UserID = 0; //default user is Bestseller | |
| 14 } | |
| 15 | |
| 16 $query = "CALL b_getMapSavedBooksByUser($UserID,'$Map')"; | |
| 17 // $output .= $query; | |
| 18 $results = mysqli_query($link, $query) or exit( mysqli_error( $link )); | |
| 19 | |
| 20 $output = ""; | |
| 21 | |
| 22 $output .= "<?xml version=\"1.0\"?>"; | |
| 23 $output .= "<results>"; | |
| 24 $output .= "<UserID>" . htmlspecialchars(trim($UserID)) . "</UserID>"; | |
| 25 | |
| 26 $prevListName = ""; | |
| 27 | |
| 28 while($line = mysqli_fetch_assoc($results)) { | |
| 29 | |
| 30 $listName = htmlspecialchars(trim($line["SavedListName"])); | |
| 31 | |
| 32 if($listName != $prevListName) | |
| 33 { | |
| 34 if($savedBooks != 0) | |
| 35 { | |
| 36 $output .= "</ListDetails>"; | |
| 37 $output .= "</List>"; | |
| 38 } | |
| 39 $output .= "<List>"; | |
| 40 $output .= "<SavedListName>" . $listName . "</SavedListName>"; | |
| 41 $output .= "<ListDetails>"; | |
| 42 $prevListName = $listName; | |
| 43 } | |
| 44 | |
| 45 $output .= "<Book>"; | |
| 46 $output .= "<ISBN>" . htmlspecialchars(trim($line["ISBN"])) . "</ISBN>"; | |
| 47 $output .= "<PictureURL>" . htmlspecialchars(trim($line["PictureURL"])) . "</PictureURL>"; | |
| 48 $output .= "<BookTitle>" . htmlspecialchars(trim($line["BookTitle"])) . "</BookTitle>"; | |
| 49 $output .= "<SaveID>" . htmlspecialchars(trim($line["SaveID"])) . "</SaveID>"; | |
| 50 $output .= "</Book>"; | |
| 51 | |
| 52 $savedBooks++; | |
| 53 } | |
| 54 | |
| 55 if($savedBooks != 0) | |
| 56 { | |
| 57 $output .= "</ListDetails>"; | |
| 58 $output .= "</List>"; | |
| 59 } | |
| 60 $output .= "</results>"; | |
| 61 | |
| 62 if(isset($ret)) | |
| 63 return $output; | |
| 64 else | |
| 65 echo $output; | |
| 66 | |
| 67 mysqli_close($link); | |
| 68 | |
| 69 | |
| 70 ?> |
