Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <?php
- include 'config/config.php';
- ?>
- <style type="text/css">
- #myInput {
- background-position: 10px 12px;
- background-repeat: no-repeat;
- width: 25%;
- font-size: 16px;
- padding: 12px 20px 12px 40px;
- border: 1px solid #ddd;
- margin-bottom: 12px;
- }
- #products {
- border-collapse: collapse;
- width: 100%;
- border: 1px solid #ddd;
- font-size: 18px;
- }
- #products th, #products td {
- text-align: left;
- padding: 12px;
- }
- #products tr {
- border-bottom: 1px solid #ddd;
- }
- #products tr.header, #products tr:hover {
- background-color: #f1f1f1;
- }
- </style>
- </head>
- <input type="text" id="myInput" onkeyup="imwireless()" placeholder="Search for location..">
- <script>
- function imwireless() {
- var input, filter, table, tr, td, i, txtValue;
- input = document.getElementById("myInput");
- filter = input.value.toUpperCase();
- table = document.getElementById("products");
- tr = table.getElementsByTagName("tr");
- for (i = 0; i < tr.length; i++) {
- td = tr[i].getElementsByTagName("td")[0];
- if (td) {
- txtValue = td.textContent || td.innerText;
- if (txtValue.toUpperCase().indexOf(filter) > -1) {
- tr[i].style.display = "";
- } else {
- tr[i].style.display = "none";
- }
- }
- }
- }
- </script>
- <?php
- ############## Make the mysql connection ###########
- try {
- $db = new PDO("mysql:host=$hostname;dbname=realestate", $username, $password);
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
- $i_d = $_POST['search'];
- ////////This is the main table for keywords//////////
- $count = $db->exec($sql);
- $sql = "Select * from realestate WHERE Store_City_State LIKE '%" . $i_d . "%' OR Store_Street_Address LIKE '%" . $i_d . "%' ";
- $result = $db->query($sql);
- echo "<table id='products'>";
- echo'<tr class="header" id="top" style="background-color:#fff111"> ';
- echo"<td>Store City State #</td>";
- echo"<td id='name'>Store_Street_Address</td>";
- echo"<td>Current Lease?</td>";
- echo"<td>Monthly Rent</td>";
- echo"<td>Lease Expire Date</td>";
- echo"<td>Open Date</td>";
- echo"<td>Notes on Location</td>";
- foreach ($result as $data) {
- echo '
- <tr style="background-color:#34495E;">
- <td id="city">'.$data["Store_City_State"].'</td>
- <td id="address">'.$data["Store_Street_Address"].'</td>
- <td id="lease">'.$data["Do_we_have_a_current_valid_Lease"].'</td>
- <td id="rent">'.$data["Current_Monthly_Rent_including_Triple_Net"].'</td>
- <td id="expdate">'.$data["Lease_expiration_date"].'</td>
- <td id="opendate">'.$data["Store_opening_date"].'</td>
- <td id="notes">'.$data["notes"].'</td>';
- }
- echo "</tr></table>";
- //echo 'entry succesfull';
- $db = null; // close the database connection
- }
- catch(PDOException $e) {
- echo $e->getMessage();
- }
- ///////// END MAIN TABLE/////////////////////////
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement