function get_text($page) { require_once "db_wrapper.php"; $db_wrapper = new db_wrapper(); $connection = $db_wrapper->connect(); $db_wrapper->select_db("vs"); $query = "select pageText from pages where pageName = '{$page}'"; $result = $db_wrapper->do_query($query); $row = $db_wrapper->fetch_array($result); echo $row['pageText']; $db_wrapper->close(); }
</form> </p> <p> <input class="button" type="button" value="Yes - Delete item" onclick="location.href = 'admin.php?p=item_delete&itemId=<?php echo $itemId; ?> &do_delete=1'"> </form> </p> <?php } else { $catPathQuery = "\n select catName, itemThumb from items join categories where itemId = '{$itemId}' and items.catId = categories.catId\n order by items.catId, itemDateAdded desc\n "; $catPathResult = $db_wrapper->do_query($catPathQuery); $catRow = mysql_fetch_array($catPathResult); $catPath = $catRow['catName']; $thumbPath = $catRow['itemThumb']; $fileNameQuery = "select imageUrl from itemimage where itemId = '{$itemId}'"; $imageUrls = $db_wrapper->do_query($fileNameQuery); while ($imageRow = mysql_fetch_assoc($imageUrls)) { $imageUrl = $imageRow["imageUrl"]; $imagePath = "../img/shop/{$imageUrl}"; if (!unlink($imagePath)) { echo "<b>Failed to delete image:</b> " . $imagePath . "<br /><br />\n"; } else { echo "<b>Image deleted!</b> " . $imagePath . "<br /><br />\n"; } } $thumbPath = "../img/shop/{$thumbPath}";
<br /> <?php require_once "../php/check_login.php"; require_once "../php/db_wrapper.php"; $db_wrapper = new db_wrapper(); $db_wrapper->connect(); $db_wrapper->select_db(); $itemQuery = "select itemId, items.catId, catName, itemTitle, itemThumb, itemDesc, itemPrice, itemDateAdded " . "from items join categories on items.catId = categories.catId " . "order by items.catId, itemDateAdded desc"; $itemResult = $db_wrapper->do_query($itemQuery); $itemId = ''; $itemTitle = ''; $itemThumb = ''; $catPath = ''; $itemPrice = ''; $itemDesc = ''; $itemDateAdded = ''; while ($row = mysql_fetch_assoc($itemResult)) { $itemId = $row["itemId"]; $itemTitle = $row["itemTitle"]; $itemThumb = $row["itemThumb"]; $catPath = $row["catName"]; $itemPrice = $row["itemPrice"]; $itemDesc = $row["itemDesc"]; $itemDateAdded = $row["itemDateAdded"]; echo "<div class=\"left\">\n"; echo "<div class=\"galleryimg\"><img src=\"../img/shop/{$itemThumb}\" height=\"125\" width=\"125\" border=\"0\"></div>\n"; echo "</div>\n"; echo "<div class=\"right\">\n"; echo "<b>{$itemTitle}</b><br />\n"; echo strtoupper($catPath) . "<br />\n"; echo "\${$itemPrice}<br />\n";
?> &imageUrl=<?php echo $imageUrl; ?> &catPath=<?php echo $catPath; ?> &do_delete=1'"> </form> </p> <?php } else { $imagePath = "../img/shop/{$imageUrl}"; if (!unlink($imagePath)) { echo "<b>Failed to delete image:</b> " . $imagePath . "<br /><br />\n"; } else { echo "<b>Image deleted!</b> " . $imagePath . "<br /><br />\n"; } $imageQuery = "delete from itemimage where itemId = '{$itemId}' and imageUrl = '{$imageUrl}' limit 1"; $db_wrapper->do_query($imageQuery); echo "Image deleted."; ?> <p> <input class="button" type="button" value="Return to Browse Items" onclick="location.href = 'admin.php?p=item_browse'"> </form> </p> <?php }