/
inventory-nolist.php
executable file
·151 lines (116 loc) · 3.17 KB
/
inventory-nolist.php
1
<? include "header.html"; ?> <? include "nav.html"; ?> <div id="main"> <? if ($_GET[mode] == "") $mode = "gallery" ; else $mode = $_GET[mode] ; switch ($mode) { case gallery: $q = mysql_real_escape_string($_GET['q']) ; $cat = mysql_real_escape_string($_GET['cat']) ; if ($cat == "") $msgcat = "all categories" ; else $msgcat = "category <q>".$cat."</q>" ; if ($q == "") $msgq = "everything" ; else $msgq = "<q>".$q."</q>" ; if($q.$cat == "") $msg = "Today's featured items:" ; else $msg = "Displaying search results for ".$msgq." in ".$msgcat."." ; echo "<p class='msg'>".$msg."</p>" ; echo " <div class='gallery'> <ul> "; if ($_GET[q] == "" and $_GET[cat] == "") $result = mysql_query(" SELECT * FROM Inventory ORDER BY Price DESC LIMIT 0,12 ",$dbcon); else $result = mysql_query(" SELECT * FROM Inventory WHERE ( Make like '%".$q."%' OR Name like '%".$q."%' OR Number like '%".$q."%' OR Description like '%".$q."%' ) AND Category like '%".$cat."%' ",$dbcon); while($row = mysql_fetch_array($result)) echo " <li> <p>" . $row['Make'] . " " . $row['Number']. "</p> <h2><a href='inventory.php?mode=view&part=" . $row['partID'] . "'>" . $row['Name'] . "</a></h2> <a href='inventory.php?mode=view&part=" . $row['partID'] . "'><img src='pictures/" . $row['partID'] . ".jpg' alt='picture' /></a> <p>Price: $" . $row['Price'] . "</p> </li> "; echo " </ul> </div> "; break; case view: $part = $_GET[part]; $result = mysql_query(" SELECT * FROM Inventory WHERE partID = ".$part." ",$dbcon); while($row = mysql_fetch_array($result)) { echo " <div class='view'> "; if (file_exists("pictures/" . $row['partID'] . ".jpg")) echo " <img src='pictures/" . $row['partID'] . ".jpg' alt='picture 1' /> " ; if (file_exists("pictures/" . $row['partID'] . "-2.jpg")) echo " <img src='pictures/" . $row['partID'] . "-2.jpg' alt='picture 2' /> " ; if (file_exists("pictures/" . $row['partID'] . "-3.jpg")) echo " <img src='pictures/" . $row['partID'] . "-3.jpg' alt='picture 3' /> " ; if (file_exists("pictures/" . $row['partID'] . "-4.jpg")) echo " <img src='pictures/" . $row['partID'] . "-4.jpg' alt='picture 4' /> " ; echo " <p>(<strong>Category:</strong> <a href='inventory.php?cat=".$row['Category']."'>".$row['Category']."</a>)</p> <h2>".$row['Make']." ".$row['Number']." ".$row['Name']."</h2> <p>".$row['Description']."</p> <p><strong>Price:</strong> $".$row['Price']."</p> <div class='details'> <h3>Details:</h3> <ul> <li><strong>Make:</strong> ".$row['Make']."</li> <li><strong>Model Number:</strong> ".$row['Number']."</li> <li><strong>Condition:</strong> ".$row['Condition']."</li> <li><strong>Age:</strong> ".$row['Age']."</li> <li><strong>Weight:</strong> ".$row['Weight']."</li> </ul> </div> </div> "; } break; }?> </div><? include "footer.html"; ?>