Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $connect = mysqli_connect("localhost", "root", "", "data");
- // Check connection
- if ($connect->connect_error) {
- die("Connection failed: " . $connect->connect_error);
- }
- if (isset($_POST['valueToSearch'])) { //Search value
- $valueToSearch = $_POST['valueToSearch'];
- $query = "SELECT * FROM data1 WHERE `Emer` LIKE '%" . $valueToSearch . "%'";
- $result = mysqli_query($connect, $query);
- } else {
- $valueToSearch = "";
- $query = "SELECT * FROM data1 WHERE `Nr.Serie` = '" . $valueToSearch . "'";
- $result = mysqli_query($connect, $query);
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Data</title>
- </head>
- <body>
- <form action="eda.php" method="post">
- <input type="text" name="valueToSearch" placeholder=" Search"><br><br>
- <input type="submit" name="Search" value="Search"><br><br>
- </form>
- <style type="text/css">
- div {text-align: center;
- font-family: Arial, sans-serif;
- overflow: auto;
- }
- table {
- width: 100%;
- }
- td {
- text-align: center;
- vertical-align: top
- }
- .tg {
- border-collapse: collapse;
- border-spacing: 0;
- border-color: #aabcfe;
- }
- .tg td {
- font-family: Arial, sans-serif;
- font-size: 18px;
- padding: 10px 5px;
- border-style: solid;
- border-width: 2px;
- overflow: hidden;
- word-break: normal;
- border-color: #aabcfe;
- color: #669;
- background-color: #e8edff;
- }
- .tg th {
- font-family: Arial, sans-serif;
- font-size: 18px;
- font-weight: normal;
- padding: 10px 5px;
- border-style: solid;
- border-width: 2px;
- overflow: hidden;
- word-break: normal;
- border-color: #aabcfe;
- color: #039;
- background-color: #b9c9fe;
- }
- .tg .tg-c3ow {
- border-color: inherit;
- text-align: center;
- vertical-align: top
- }
- .tg .tg-us36 {
- border-color: inherit;
- vertical-align: top
- }
- .tg .tg-ov9q {
- background-color: #D2E4FC;
- border-color: inherit;
- vertical-align: top
- }
- </style>
- <table class="tg">
- <th class="tg-c3ow">Nr.Serie</th>
- <th class="tg-us36">Emer</th>
- <th class="tg-us36">Mbiemer</th>
- <th class="tg-us36">Kompania</th>
- <th class="tg-us36">Nr.Aplikimit</th>
- <th class="tg-us36">Vendbanimi</th>
- <th class="tg-us36">Kategoria</th>
- <th class="tg-us36">Data Aplikimit</th>
- <th class="tg-us36">Data Terheqjes</th>
- <th class="tg-us36">Profesioni</th>
- <th class="tg-us36">Statusi</th>
- </tr>
- <!-- populate table from mysql database -->
- <?php
- if (mysqli_num_rows($result) > 0)
- while ($row = mysqli_fetch_array($result)) {
- $m = date('d/m/Y');
- $t = $row['Data Terheqjes'];
- $c='';
- echo $m<$t;
- if ($m <$t){$c ='Aktiv';}
- else {$c ='JO Aktiv';}
- ?>
- <tr>
- <tr>
- <td class="tg-ov9q"><?php echo $row['Nr.Serie']; ?></td>
- <td class="tg-ov9q"><?php echo $row['Emer']; ?></td>
- <td class="tg-ov9q"><?php echo $row['Mbiemer']; ?></td>
- <td class="tg-ov9q"><?php echo $row['Kompania']; ?></td>
- <td class="tg-ov9q"><?php echo $row['Nr.Aplikimit']; ?></td>
- <td class="tg-ov9q"><?php echo $row['Vendbanimi']; ?></td>
- <td class="tg-ov9q"><?php echo $row['Kategoria']; ?></td>
- <td class="tg-ov9q"><?php echo $row['Data Aplikimit']; ?></td>
- <td class="tg-ov9q"><?php echo $row['Data Terheqjes']; ?></td>
- <td class="tg-ov9q"><?php echo $row['Profesioni']; ?></td>
- <td class="tg-ov9q"><?php echo $c?></td>
- </tr>
- </tr>
- <?php }
- else{
- echo "<tr><td colspan='11'> NO records found </td></tr>";
- }
- ?>
- </table>
- </body>
- </html>
Add Comment
Please, Sign In to add comment