Advertisement
Guest User

help me thelegend

a guest
Aug 4th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. //index.html
  2.  
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <link rel="stylesheet" type="text/css" href="main.css">
  7. <title></title>
  8. </head>
  9. <body>
  10. <div class="form">
  11. <form action="sqlscript1.php" method="post">
  12. <input type="text" name="search" placeholder="search..."><br>
  13. </form>
  14. </div>
  15. </body>
  16. </html>
  17.  
  18.  
  19. //sqlscript1.php
  20.  
  21. <!DOCTYPE html>
  22. <html>
  23. <head>
  24. <title></title>
  25. </head>
  26. <body>
  27. <?php
  28. session_start(A);
  29. ?>
  30.  
  31. <?php
  32. $servername = "";
  33. $username = "";
  34. $password = "";
  35. $dbname = "";
  36.  
  37. //create connection
  38. $conn = new mysqli($servername, $username, $password, $dbname);
  39. //check connection
  40. if ($conn->connect_error){
  41. die("Connection failed: " . $conn->connect_error);
  42. }
  43.  
  44. $id = $_POST['search'];
  45.  
  46. $sql = "SELECT * FROM VIDEO_SEARCH WHERE VIDEO_ID LIKE '%$id%'";
  47. $result = $conn->query($sql);
  48.  
  49. if ($result->num_rows > 0) {
  50. // output data of each row
  51. $row = $result->fetch_assoc();
  52. echo "<a href=\"loadvideo.php\">" . $row["VIDEO_NAME"] . "</a>";
  53. $_SESSION["row"] = $row;
  54. } else {
  55. echo "0 results";
  56. }
  57. $conn->close();
  58. ?>
  59. </body>
  60. </html>
  61.  
  62.  
  63. //loadvideo.php
  64.  
  65. <?php
  66. session_start(A);
  67. ?>
  68. <?php
  69. $servername = "";
  70. $username = "";
  71. $password = "";
  72. $dbname = "";
  73.  
  74. //create connection
  75. $conn = new mysqli($servername, $username, $password, $dbname);
  76. //check connection
  77. if ($conn->connect_error){
  78. die("Connection failed: " . $conn->connect_error);
  79. }
  80.  
  81. $handle = $_SESSION["row"]["VIDEO_LOC"];
  82. echo $handle;
  83.  
  84. //echo video tag here
  85.  
  86. $conn->close();
  87. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement