Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //if nothing entered in the form, the user is redirected back to the form
- if(empty($_GET['fname'])){
- header ("Location: index.html");
- exit;
- }
- ?>
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <title>Search Results</title>
- <style type="text/css">
- body, h2, tr { text-align: center }
- </style>
- </head>
- <body>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "students";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- ?> <h2> Vie vnesovte : </h2><h2>"<?php echo $_GET["fname"]; ?> "</h2><br>
- <h2> Studenti so ime kako vnesenoto: </h2> <br>
- <?php
- $fname = $_GET["fname"];
- $sql = "SELECT * FROM student WHERE firstname like '%$fname%'";
- $result = $conn->query($sql);
- $brojac=1;
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- echo "".$brojac.". ID: " .$row["sid"]. " | Ime i Prezime: " . $row["firstname"]. " " . $row["lastname"]. " | Adresa: ". $row["address"] . " | Telefon: " . $row["telephone"]." | Data na ragjanje: ".$row["dob"]."<br>";
- $brojac=$brojac+1;
- }
- } else {
- ?><h2>Imeto koe go vnesovte ne postoi vo databazata!</h2> <?php
- }
- $conn->close(); ?>
- <br/><a href="index.html"><< Back to Search</a>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement