Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //index.html
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" type="text/css" href="main.css">
- <title></title>
- </head>
- <body>
- <div class="form">
- <form action="sqlscript1.php" method="post">
- <input type="text" name="search" placeholder="search..."><br>
- </form>
- </div>
- </body>
- </html>
- //sqlscript1.php
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <?php
- session_start(A);
- ?>
- <?php
- $servername = "";
- $username = "";
- $password = "";
- $dbname = "";
- //create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- //check connection
- if ($conn->connect_error){
- die("Connection failed: " . $conn->connect_error);
- }
- $id = $_POST['search'];
- $sql = "SELECT * FROM VIDEO_SEARCH WHERE VIDEO_ID LIKE '%$id%'";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- $row = $result->fetch_assoc();
- echo "<a href=\"loadvideo.php\">" . $row["VIDEO_NAME"] . "</a>";
- $_SESSION["row"] = $row;
- } else {
- echo "0 results";
- }
- $conn->close();
- ?>
- </body>
- </html>
- //loadvideo.php
- <?php
- session_start(A);
- ?>
- <?php
- $servername = "";
- $username = "";
- $password = "";
- $dbname = "";
- //create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- //check connection
- if ($conn->connect_error){
- die("Connection failed: " . $conn->connect_error);
- }
- $handle = $_SESSION["row"]["VIDEO_LOC"];
- echo $handle;
- //echo video tag here
- $conn->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement