Guest User

Untitled

a guest
Mar 13th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 KB | None | 0 0
  1. scarecrowVidDB
  2. CUSTOMER
  3. idCUSTOMER
  4. fname
  5. lname
  6. address
  7. city
  8. state
  9. IMDb_ID(1)
  10. IMDb_ID(2)
  11. movRenStart
  12. movRenEnd
  13. PRIMARY
  14.  
  15. RENT/BUY
  16. IMDb_ID
  17. Type
  18. Title
  19. Year
  20. Plot
  21. Actors
  22. Director
  23. Writer
  24. Country
  25. Languages
  26. Metascore
  27. imdbVotes
  28. imdbRating
  29. Rated
  30. Runtime
  31. Released
  32. quantity
  33. price
  34. Genre
  35. PRIMARY
  36.  
  37. function MyViewModel() {
  38. var self = this;
  39.  
  40.  
  41. self.movies = ko.observableArray();
  42. self.searchTerm = ko.observable();
  43. self.moreInfo = ko.observableArray();
  44.  
  45. self.currentMovie = {
  46. Type: ko.observable(),
  47. Year: ko.observable(),
  48. Genre: ko.observable(),
  49. Released: ko.observable(),
  50. Runtime: ko.observable(),
  51. Poster: ko.observable(),
  52. Rated: ko.observable(),
  53. imdbID: ko.observable(),
  54. imdbRating: ko.observable(),
  55. imdbVotes: ko.observable(),
  56. Metascore:ko.observable(),
  57. Actors: ko.observable(),
  58. Plot: ko.observable(),
  59. Writer: ko.observable(),
  60. Director: ko.observable(),
  61. Country: ko.observable(),
  62. Language: ko.observable(),
  63. Title: ko.observable()
  64. };
  65.  
  66.  
  67. self.error = ko.observable(false);
  68. self.errorMessage = ko.observable();
  69.  
  70. self.searchForMovies = function () {
  71. if($(".searchForm").val() == ""){
  72. alert("Please Enter a search movie!")
  73. return;
  74. }
  75.  
  76. $.getJSON("http://www.omdbapi.com/?apikey=f133f8f8&s=" + self.searchTerm(), {
  77. }).done(function (data) {
  78. self.error(false);
  79. self.errorMessage('');
  80.  
  81. if (data.Search) {
  82. ko.mapping.fromJS(data.Search, {}, self.movies);
  83. } else {
  84. self.error(true);
  85. self.errorMessage(data.Error);
  86. }
  87. });
  88. };
  89.  
  90. self.viewMoreInfo = function (movie) {
  91. $.getJSON("http://omdbapi.com/?apikey=f133f8f8&t=" + movie.Title(), {
  92. }).done(function (data) {
  93. self.error(false);
  94. self.errorMessage('');
  95.  
  96. if (data) {
  97. ko.mapping.fromJS(data, {}, self.currentMovie);
  98. } else {
  99. self.error(true);
  100. self.errorMessage(data.Error);
  101. }
  102. });
  103. };
  104.  
  105. self.clear = function(){
  106. $(".searchForm").val("");
  107. $(".results").fadeOut("fast");
  108. };
  109. };
  110.  
  111.  
  112.  
  113. ko.applyBindings(new MyViewModel());
  114.  
  115. <?php
  116. /**
  117. * Created by PhpStorm.
  118. * User: ***********
  119. * Date: 3/10/18
  120. * Time: 5:31 AM
  121. */
  122.  
  123. $servername = "localhost";
  124. $username = "root";
  125. $password = "";
  126. $db = "scarecrowVidDB";
  127.  
  128. // Create a connection
  129.  
  130. $con = mysqli_connect($servername, $username, $password,$db);
  131.  
  132. // Check the connection
  133. if(!$con){
  134. die("The connection failed: ".mysqli_connect_error());
  135. }
  136.  
  137. <?php
  138. /**
  139. * Created by PhpStorm.
  140. * User: *************
  141. * Date: 3/9/18
  142. * Time: 3:41 PM
  143. */
  144. include "DB.php";
  145. if(isset($_POST["imdb_ID"])){
  146. **$movie_query = 'INSERT INTO scarecrowVidDB.`RENT/BUY`';**
  147. $run_query = mysqli_query($con, $movie_query);
  148.  
  149. if(mysqli_num_rows($run_query)> 0){
  150. while($row = mysqli_fetch_array($run_query)){
  151. $cat_ID = $row['category_ID'];
  152. $imdbID = $row['IMDb_ID'];
  153. $Title = $row['title'];
  154. $Year = $row['year'];
  155. $Price = $row['price'];
  156.  
  157. }
  158. }
  159. }
Add Comment
Please, Sign In to add comment